Currently facing an issue that I want to click the checkbox only for selecting the whole row instead of tap the content of the row. This is because I wish to navigate to the other pages when tapping on the content.
Therefore I hope that, there is a way to do this.
Thank you.
Hi Jacqueline,
Based on the current structure of the DataGrid, selecting rows only through the built-in checkbox column is not supported. However, you can achieve your requirements through a workaround. To implement this, you should use checkboxes at the sample level to select rows programmatically. Additionally, you can restrict row selection when tapping on row contents to meet your needs.
To implement this, use the Checkbox component in a separate column at the sample level instead of the DataGrid's built-in checkbox. In the ` DataGridSource.buildRow` method, return the checkbox if it's a checkbox column. In the `Checkbox.onChanged` callback, set the corresponding row to `DataGridController.selectedRow` to select rows programmatically.
To disable selection when clicking on row cells, return `false` from the `SfDataGrid.onSelectionChanging` callback. This will disable selection for row cells.
For your reference, we have provided a simple sample that demonstrates this approach. In this sample, you can select rows exclusively through the checkbox, and tapping on row contents allows you to navigate to another page. Please review the sample below for further details.
Regards,
Tamilarasan
Thank you so much!!
Hi Jacqueline,
If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you.
Regards,
Tamilarasan
Tamilarasan Paranthaman is true.!