-
Notifications
You must be signed in to change notification settings - Fork 893
[SfDataGrid] Add RowColumnIndex to SelectionChangingCallback #1735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Get pressed cell's `RowColumnIndex` details to better handle the row selection
Get pressed cell's `RowColumnIndex` details to better handle the row selection
Resolves issue #1041 Usage : SfDataGrid(
...
onSelectionChanging: (addedRows, removedRows, index) {
// Allow selection only for the checkbox column
if (index.columnIndex == 0) {
return true;
}
return false;
},
...
) |
Hi @deepss1 , Based on the information provided, you are expecting to allow selection only for the checkbox column. Currently, the DataGrid doesn’t support selecting rows only by the checkbox column. However, we have a workaround that can help you achieve your requirement. You can disable row selection by returning false from the onSelectionChanging callback, which will allow you to restrict the selection by tapping on other cells. To select rows using checkboxes, we recommend not using the in-built DataGrid checkbox column. Instead, you can add a checkbox as the first column in the GridColumn collection. You can also add a checkbox for each corresponding row cell in the DataGridSource.buildRow method. By wrapping a GestureDetector as a parent for the checkbox column, you can select rows programmatically on tap and double-tap using the DataGridController when the checkbox is selected. We have attached the sample file for your reference. Please refer to the following sample for more information.
Regards, |
Thanks for your response. I have checked this workaround as it was mentioned in the issue #1041 However, it also required me to implement a select all, un-select all, and show partially selected. After achieving this behaviour, the data grid would automatically scroll to the last row after trying to select all rows. To avoid over engineering the checkbox functionality, it made more sense having the IMO this PR can be more convenient for the devs without any major change. |
Hi @deepss1, As of now, we have considered your request as a feature. We will implement this feature. During the planning stage for every release cycle, we review all open features and identify those for implementation based on specific parameters, including product vision, technological feasibility, and customer interest. We appreciate your patience and understanding until then. Regards, |
Hi @deepss1, We are closing this issue now. If you need any further assistance, kindly reopen this issue. We are always happy to help you. Regards, |
Get pressed cell's
RowColumnIndex
details to better handle the row selection