bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
664 stars 305 forks source link

onSelected does not trigger with PlutoGridMode.normal[Bug] #886

Closed sharpsaravanan closed 1 year ago

sharpsaravanan commented 1 year ago

onSelected event does not trigger in mode: PlutoGridMode.normal

PlutoGrid( columns: columns, rows: rows, mode: PlutoGridMode.normal, onSelected: (PlutoGridOnSelectedEvent event) { print('onSelected'); //does not trigger }, )

Execution Environment

flutter --version
Flutter 3.10.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 796c8ef792 (4 weeks ago) • 2023-06-13 15:51:02 -0700 Engine • revision 45f6e00911 Tools • Dart 3.0.5 • DevTools 2.23.1

PlutoGrid version pluto_grid: ^7.0.2

mucahitbircan commented 1 year ago

try static func like this:

onSelected: onSelected, )

void onSelected(PlutoGridStateManager stateManager, PlutoGridOnSelectedEvent event) { if (event.row != null) { setState(() { isRowSelected = true; selectedUser = _users.firstWhereOrNull((element) => element.id == event.row!.cells["id"]!.value); blockText = selectedUser!.blocked! ? "Unblock" : "Block"; }); } else { isRowSelected = false; } }

ichigoryume commented 1 year ago

I have same issue as sharpsaravanan. I think this is because isEditableMode getter of PlutoGridMode enum is imlemented like this

bool get isEditableMode => isNormal || isPopup;

It should be like this

bool get isEditableMode => isNormal || isPopup || isSelectMode;
github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.