<button @onclick="Select">Get Selected records</button>
<div>Selected Count - @Count</div>
<SfGrid @ref="Grid" DataSource="@Orders" AllowFiltering="true" AllowSelection="true" AllowPaging="true" Height="315">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
<GridSelectionSettings Type="SelectionType.Multiple"></GridSelectionSettings>
<GridColumns>
<GridColumn Type="ColumnType.CheckBox" Width="50"></GridColumn>
...
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> Grid;
public List<Order> Orders { get; set; }
public int Count { get; set; } = 0;
. . .
public async Task Select()
{
var rec = await Grid.GetSelectedRecords();
Count = rec.Count();
}
} |