Blazorise Specifications: DataGrid
Learn how the DataGrid behaves when data loading, selection, and editing options interact.
ReadData and Virtualize
When ReadData is supplied, the grid switches to manual data mode. Sorting, filtering, and paging update column state and raise events, but the grid does not apply them to Data.
ReadData receives DataGridReadDataMode.Paging with Page/PageSize, or DataGridReadDataMode.Virtualize with virtualizeOffset/virtualizeCount.
When using Virtualize with ReadData, TotalItems must be set for correct virtualization.
Virtualize vs Paging
When Virtualize is enabled, internal paging is bypassed even if ShowPager is true. DisplayData contains the full filtered set, and virtualization only controls what is rendered.
Page/PageSize only affect ReadData paging mode; virtualized reads use the virtualization request counts instead.
Filter changes in virtualize mode reset the scroll position to the top before the next data request.
Selection Modes
SelectionMode.Single uses SelectedRow, while SelectionMode.Multiple uses SelectedRows.
Switching modes syncs selection: SelectedRow is added to SelectedRows when switching to multiple, SelectedRows is cleared when switching to single, and clearing SelectedRows in multiple resets SelectedRow.
Single selection supports Ctrl-click to unselect the current row (Cmd-click on macOS). Multiple selection supports Shift-click range selection based on the current DisplayData order.
Select All and RowSelectable
The multi-select "select all" checkbox operates on DisplayData (current filter and paging state).
If RowSelectable is supplied, only rows that pass RowSelectable with DataGridSelectReason.MultiSelectAll are included.
Selection While Editing
While a row is being edited, selection changes are ignored unless the grid forces selection (for example when entering cell edit). This prevents losing edit context when clicking other rows.
Detail Row Trigger
When DetailRowTrigger returns Single, opening one detail row closes any other open detail rows. Use ToggleDetailRow with forceDetailRow to bypass the trigger when needed.