In the DataGrid multi select example Blazor DataGrid multiple selection (radzen.com) , I am able to get it to work when I am using IEnumerable.
But I am trying to make the grid more "generic" so it does not rely on the model. Instead, my grid uses IEnumerable<IDictionary<string, object>>.
I am able to get the grid to work, but following the code example, I can't get the multi-select tristate checkboxes to work.
Select/unselect the individual rows at a time works, but the issue comes when trying to select-all / unselect-all from the header.
The "Contains" is not working. The contains is always reporting "false".
gridSelectedItems.Contains(i)
Here is the complete column syntax
<RadzenDataGridColumn TItem="IDictionary<string, object>" Width="60px" Sortable="false" Filterable="false" TextAlign="TextAlign.Center" Groupable="false" Pickable="false">
<HeaderTemplate>
<RadzenCheckBox TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select all items" }})" Value="@(gridSelectedItems == null || gridSelectedItems?.Any() != true ? false : !griddata.All(i => gridSelectedItems.Contains(i)) ? null : griddata.Any(i => gridSelectedItems.Contains(i)))" Change="@(args => gridSelectedItems = args == true ? griddata.ToList() : null)" />
</HeaderTemplate>
<Template Context="data">
<RadzenCheckBox TriState="false" TValue="bool" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select item" }})" Value="@(gridSelectedItems != null && gridSelectedItems.Contains(data))" Change="@(args => UpdateSelection(data))" />
</Template>
</RadzenDataGridColumn>