This example prevents users from selecting specific data items in the DevExpress Blazor Grid.
A selection column displays checkboxes that selects/deselects Blazor Grid items. In this example, the Grid component disables selection checkboxes for items whose Summary field is set to Mild
. The Select All checkbox also ignores these items.
Follow the steps below to enable selection only for items matching your criteria:
-
Use the DxGridSelectionColumn.CellDisplayTemplate to replace the built-in checkbox with a custom DxCheckBox editor.
-
Implement two-way data binding between the Checked checkbox property and the template context's Selected property.
-
Set the Enabled property to
true
/false
, based on the current item. -
Place another DxCheckBox component in the DxGridSelectionColumn.HeaderTemplate to display a custom Select All checkbox.
-
Configure this checkbox to support three states (checked, unchecked, and indeterminate).
-
In the CheckedChanged event, select/deselect all Grid records that match your criteria.
-
Update the Select All checkbox state when the Grid raises the SelectedDataItemsChanged event.
- Blazor Grid - How to display detailed information using DxFormLayout
- Blazor Grid - How to delete selected rows
(you will be redirected to DevExpress.com to submit your response)