Grid checkbox is read only
I've put a checkbox in a grid column but it's read only at run time. What am I doing wrong?
<SfGrid @ref="grid" DataSource="@Invoices" AllowSorting="true">
<GridEditSettings AllowEditing="true" Mode="EditMode.Normal" AllowEditOnDblClick="false"></GridEditSettings>
<GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings>
<GridEvents QueryCellInfo="@OnQueryCellInfo" TValue="Invoice"></GridEvents>
<GridColumns>
<GridColumn Field="@nameof(Invoice.Id)" IsPrimaryKey="true" Visible="false"></GridColumn>
<GridColumn Field="@nameof(Invoice.IsSelected)" AllowEditing="true" AutoFit HeaderText="Selected" DisplayAsCheckBox="true"></GridColumn>
<GridColumn Field=@nameof(Invoice.Date) AllowEditing="false" HeaderText="Date" Format="dddd, MMMM d, yyyy" Width="250"></GridColumn>
<GridColumn Field=@nameof(Invoice.Title) AllowEditing="false" HeaderText="Title"></GridColumn>
</GridColumns>
</SfGrid>
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
March 16, 2021 04:09 AM UTC
Hi Andy,
Thanks for contacting Syncfusion support.
Query: “I've put a checkbox in a grid column but it's read only at run time. What am I doing wrong?”
We have analyzed your query and we understand that you are facing difficulties in checkbox column. From your code example, we found that you have rendered Boolean column in grid and displayed as checkbox using DisplayAsCheckbox property. We would like to inform you that Initially Boolean column (displayed as checkbox) will be in disabled state only, while editing a the record only checkboxes can be edited / changed.
But you have disabled editing on double click. So kindly share following details about your requirement.
- Do you want to render checkbox column in Grid and perform selecting? If yes, share below UG documentation for your reference
- Do you want to edit the Boolean column (checkbox control) on single click and update the changes in your datasource?
- Share more details about your requirement.
Above requested details will be very helpful for us to analyze the requested details at our end and provide better solution.
Regards,
Vignesh Natarajan
Marked as answer
AR
Andy Richard
March 16, 2021 05:47 PM UTC
I'm trying to have the checkbox select the row. So it turns out I have to specify Type="ColumnType.CheckBox" as your example mentions as well as remove DisplayAsCheckbox. That did the trick. Thank you.
VN
Vignesh Natarajan
Syncfusion Team
March 17, 2021 03:47 AM UTC
Hi Andy,
Thanks for the update.
We are glad to hear that you have resolved your query using our solution.
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
AR Andy Richard
- Mar 15, 2021 03:00 PM UTC
- Mar 17, 2021 03:47 AM UTC