Unplanned
Last Updated: 18 Feb 2025 14:15 by Sihol
Sihol
Created on: 18 Feb 2025 14:15
Category: Spreadsheet
Type: Bug Report
2
Make the ColumnsCount parameter reactive

I want to change the ColumnsCount property value at runtime, for example, based on the Excel files that the app is loading.

===

TELERIK EDIT:

A possible workaround is to recreate the Spreadsheet component. The downside will be a minor UI flicker. Alternatively, set ColumnsCount to a small value like 1. In this way the component will display only the existing columns in the opened file.

<TelerikNumericTextBox @bind-Value="@SpreadsheetColumnsCount"
                       Min="0" Max="999"
                       Width="80px" />

<TelerikButton OnClick="@OnButtonClick">Apply ColumnsCount</TelerikButton>

@if (SpreadsheetVisible)
{
    <TelerikSpreadsheet Data="@SpreadsheetData"
                        ColumnsCount="@SpreadsheetColumnsCount">
    </TelerikSpreadsheet>
}

@code {
    private byte[]? SpreadsheetData { get; set; }

    private int SpreadsheetColumnsCount { get; set; } = 10;

    private bool SpreadsheetVisible { get; set; } = true;

    private async Task OnButtonClick()
    {
        SpreadsheetVisible = false;
        await Task.Delay(1);

        SpreadsheetVisible = true;
    }
}

 

0 comments