Welcome to the Flutter feedback portal. We’re happy you’re here! If you have feedback on how to improve the Flutter, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

I am using a SfDataGrid with SelectionMode.multiple and showCheckboxColumn = true

If I select all the rows via the checkbox column in the header; and then unselect all the rows by unchecking the checkbox column in the header - the onSelectionChanged event is called with 0 added rows and 0 removed rows (when i believe it should be called with the rows that were removed)

I believe the problem is in the handleSelectionFromCheckbox method that is in the SelectionManager class - specifically in the following bit of code:

final List<DataGridRow> oldSelectedItems =
rowSelectionManager._selectedRows;
if (rowSelectionManager._raiseSelectionChanging(
newItems: <DataGridRow>[], oldItems: oldSelectedItems)) {
rowSelectionManager._clearSelectedRows(dataGridConfiguration);
rowSelectionManager._refreshCheckboxSelection();
rowSelectionManager._raiseSelectionChanged(
oldItems: oldSelectedItems, newItems: <DataGridRow>[]);
}

I noticed that when stepping through the code that oldSelectedItems initially has the unselected rows  - however, it was being cleared when rowSelectionManager._clearSelectedRows(dataGridConfiguration) was being called

to correct the issue I believe the line where oldSelectedItems is initialized should be changed to oldSelectedItems = rowSelectionManager._selectedRows.toList() which would create a copy of the list instead of a reference to the list.

Regards,

Jeff