Hi Awais,
Based on the information you provided, we were unable to
reproduce the reported issue. We tested the following sample, and it was
working correctly on our end. Please check the following code snippet and sample.
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter SfDataGrid'),
),
body: SfDataGrid(
source: _employeeDataSource,
columns: getColumns,
selectionMode: SelectionMode.multiple,
navigationMode:
GridNavigationMode.cell,
columnWidthMode: ColumnWidthMode.fill,
onCurrentCellActivating:
(newRowColumnIndex, oldRowColumnIndex) {
if
(newRowColumnIndex.columnIndex == 1) {
return false;
}
return true;
},
),
);
}
|
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample1892929281
In this sample, we have restricted row
selection when selecting a cell in the "ID" column. To ensure that
the onCurrentCellActivating callback is working correctly, please make sure
that you have set the SfDataGrid.navigationMode to GridNavigationMode.cell.
If you are already using the GridNavigationMode.cell
mode and are still experiencing issues, please provide us with more details
about your use case and the behavior you are seeing. We would appreciate it if
you provided a simple sample. This will help us better understand the issue and
assist you in finding a solution.
To cancel row selection based on certain
conditions when using the GridNavigationMode.row mode, you can use the onSelectionChanging
callback. This callback is called before a row is selected, and you can return
false from the callback to cancel the selection for the corresponding row.
For more information on the
onSelectionChanging callback, please see the following API documentation:
API documentation: https://pub.dev/documentation/syncfusion_flutter_datagrid/latest/datagrid/SfDataGrid/onSelectionChanging.html
We have also provided detailed information
on the onSelectionChanging callback in our user guide. You can find this
information at the following URL:
UG Document: https://help.syncfusion.com/flutter/datagrid/selection#callbacks
Regards,
Tamilarasan