-
Notifications
You must be signed in to change notification settings - Fork 460
Open
Labels
status:needs-investigationNeeds additional investigationNeeds additional investigation
Milestone
Description
🐛 Bug Report
When using the SelectColumn with SelectMode multiple, if you have selected items within code, the checkbox in the header should be filled as some rows are selected but it's empty and the hover over says "no rows are selected"
💻 Repro or Code Sample
@page "/data-grid"
<PageTitle>Data Grid</PageTitle>
<h1>Data Grid</h1>
<FluentDataGrid Items="@People"
ShowHover="true"
TGridItem="Person"
GenerateHeader="GenerateHeaderOption.Sticky"
RowSize="DataGridRowSize.Small"
Virtualize=false
ItemSize="32"
ResizableColumns=true
GridTemplateColumns="50px auto auto auto auto">
<SelectColumn TGridItem="Person"
SelectMode="DataGridSelectMode.Multiple"
Property="@(e=> e.IsSelected)"
OnSelect="@(e => e.Item.IsSelected = e.Selected)"
SelectAll="@(People.All(p => p.IsSelected))"
SelectAllChanged="@(all => People.ToList().ForEach(p => p.IsSelected = (all == true)))" />
<PropertyColumn Property="@(p => p.PersonId)" Title="ID" />
<PropertyColumn Property="@(p => p.Name)" />
<PropertyColumn Property="@(p => p.HairColour)" />
<PropertyColumn Property="@(p => p.BirthDate)" Format="yyyy-MM-dd" Sortable="true" />
</FluentDataGrid>
<div>
<b>SelectedItems:</b>
@String.Join("; ", SelectedItems.Select(p => p.Name))
</div>
@code {
IEnumerable<Person> SelectedItems = People.Where(p => p.IsSelected);
record Person(int PersonId, string Name, DateOnly BirthDate, string HairColour)
{
public bool IsSelected { get; set; }
};
static IQueryable<Person> People = new[]
{
new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16),"Brown"){IsSelected=true},
new Person(10944, "António Langa", new DateOnly(1991, 12, 1),"Black"),
new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10),"Blonde"),
new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27),"Ginger"),
new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3),"Bald"),
new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9),"Grey"),
}.AsQueryable();
}
🤔 Expected Behavior
Header checkbox in correct state.
😯 Current Behavior
It's not in correct state.
🌍 Your Environment
- OS & Device: Windows 11
- Browser: Chrome
- .NET 10 and Fluent UI Blazor library Version 4.13.1
Metadata
Metadata
Assignees
Labels
status:needs-investigationNeeds additional investigationNeeds additional investigation