Hi Keith,
Thanks for contacting Syncfusion support.
Query: “Whenever I set a bool column to Checkbox, I get a Select All checkbox in the header and I don't want that.”
We have analyzed your query and we would like to inform you that CheckBox type column is used to perform selection in Grid. Boolean column cannot be assigned to checkbox type column, because checkbox wont be selected based on the datasource value.
So we request you to achieve your requirement using ColumnTemplate feature of Grid. Refer the below code example
| <SfGrid @ref="GridInstance" DataSource="@OrderData"> <GridColumns> <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Center" Width="120"></GridColumn> <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer ID" TextAlign="TextAlign.Center" Width="130"></GridColumn> <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" TextAlign="TextAlign.Center" Width="130"></GridColumn> <GridColumn Field=@nameof(Order.ShipName) HeaderText="Ship Name" TextAlign="TextAlign.Center" Width="120"></GridColumn> <GridColumn Field=@nameof(Order.Verified) HeaderText="Verified" TextAlign="TextAlign.Center" Width="120"> <Template> @{ var ord = context as Order; <SfCheckBox @bind-Checked="ord.Verified" ValueChange="@((args)=>OnChange(args, ord))" TChecked="bool"></SfCheckBox> } </Template> </GridColumn> </GridColumns></SfGrid> @code{ SfGrid<Order> GridInstance { get; set; } public async Task OnChange(ChangeEventArgs<bool> args, Order ord) { ord.Verified = args.Checked; var rowIndex = await GridInstance.GetRowIndexByPrimaryKeyAsync(ord.OrderID); await GridInstance.UpdateRowAsync(rowIndex, ord); }
|
For your convenience we have prepared a sample using above code example, which can be downloaded from below
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan