Conversation
|
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 61.2%
|
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where the SelectColumn's initial state was not displayed correctly when using the Property parameter (instead of SelectedItems) with items that were already in a selected state.
Changes:
- Modified the
GetSelectAll()method to check thePropertyparameter against grid items to determine initial selection state - Changed the default value of
SelectAllfromfalsetonullto allow proper state calculation - Fixed a spelling error in the demo example ("Peoples" → "People")
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/Components/DataGrid/Columns/SelectColumn.cs | Fixed initial state detection by checking Property parameter against grid items; changed SelectAll default from false to null |
| examples/Demo/Shared/Pages/DataGrid/Examples/DataGridMultiSelect.razor | Corrected spelling from "Peoples:" to "People:" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (InternalGridContext != null && (Grid.Items != null || Grid.ItemsProvider != null)) | ||
| { | ||
| if (_selectedItems.Count == 0) | ||
| if (_selectedItems.Count == 0 && !InternalGridContext.Items.Any(Property)) |
There was a problem hiding this comment.
The call to InternalGridContext.Items.Any(Property) iterates through all items in the grid each time GetSelectAll() is invoked. For large datasets, this could impact performance. Consider caching this result or using an alternative approach if RefreshHeaderContent() is called frequently. However, since RefreshHeaderContent() is only called when selection state changes, this may be acceptable for most use cases.
When not using
SelectedItems, the initial state would not be displayed correctly is any item was actually in a selected state. This PR fixes that by including a check on the thePropertyparameter of the (InternalGridContext)Items