OpenColumnChooserAsync

I have a grid with 45 columns.

I allow the user to customize the grid view and choose the columns depends on her needs.

For that I placed a button in the grid toolbar that on its click I call OpenColumnChooserAsync


Is there any indication that  the Column Chooser dialog is in progress, so I will use it to disable that button.

The reason: It takes time until the columns dialog is shown and the user keep clicking on that button.

I can disable it for some time, but I prepare more elegant method 

With regards




1 Reply

SP Sarveswaran Palani Syncfusion Team December 8, 2023 03:53 AM UTC

Hi Alon,

Greetings from Syncfusion support.

From your query, it seems you want to disable a toolbar button while handling the column chooser feature in the Grid toolbar for larger columns. Based on your request, we have achieved your requirement using disable property in SfButton component. Kindly refer the attached code snippet and sample for your reference.

<SfGrid DataSource="@Orders" AllowPaging="true" AllowExcelExport="true" ShowColumnChooser="true" AllowPdfExport="true" Height="200" @ref="Grid">

    <SfToolbar>

        <ToolbarItems>

            <ToolbarItem Type="ItemType.Input">

                <Template>

                    <div>

                        <SfButton id="addButton" Disabled="@disable" OnClick="columnchooser">Column Chooser</SfButton>

                    </div>

                </Template>

            </ToolbarItem>

        </ToolbarItems>

    </SfToolbar>

    <GridColumns>

      .

      .

      .

    </GridColumns>

</SfGrid>

@code {

    private SfGrid<OrderData> Grid;


    private Boolean disable = false;

 

    public async Task columnchooser()

    {

        disable = true;

        await this.Grid.OpenColumnChooserAsync();

        disable = false;

    }

}


Sample: https://blazorplayground.syncfusion.com/embed/VjVACBtcTfhyuLRP?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

If you have any further queries, please get back to us.

Regards,
Sarvesh


Loader.
Up arrow icon