Blazor Grid - Column chooser
The Blazor Grid component shows tabular data with client-side or server-side paging, sorting and filtering, plus selection, a column chooser, saved settings and CSV export. The example below lets people show, hide and reorder columns, and keeps their choice in saved grid settings.
Column chooser #
Let people choose which columns they see and in what order. A Columns button above the grid opens a list with a search box, a checkbox for each column, and move up and move down buttons; columns can also be dragged.
How to use:
Change the text with
How to use:
- Set
AllowColumnChooser="true"on the Grid. - Give each column a
PropertyNameorHeaderText; the chooser lists the columns by it. - Set
AlwaysVisible="true"on a column people must not hide. The last visible column can never be hidden. - To keep the choice, handle
GridSettingsChangedand return the saved settings fromSettingsProvider.GridSettings.ColumnOrderandGridSettings.HiddenColumnshold it. Reset to default, orResetColumnsAsync(), restores the declared columns.
ColumnChooserButtonText, ColumnChooserSearchPlaceholderText, ColumnChooserResetText, and the other ColumnChooser*Text parameters.