Reputation: 3380
When I enable keyboard selection policy and multi selection on DataGrid
I encountered this problem.
Case 1 : Multi selection through mouse and keyboard
When I want to select more than one row through mouse, I hold Ctrl
key or Shift
key and this works fine. Through keyboard by default, this action is provided by spacebar
. When I want to select serially through keyboard combination of shift
key and spacebar
does the trick.
Case 2 : Single selection through mouse and keyboard (This is where the problem starts)
When I want to select a single row through mouse, I just do a left click
. If I don't hold either of ctrl
of shift
key and do a left click
, even if the multiple rows are selected, it will get deselected and only the current row gets selected. This is the expected behavior and I don't have any issue with it.
But the same thing is not achievable through keyboard. There is no way to select a single row through keyboard. If I press spacebar
a row gets selected and if I press the spacebar
again on some other row without shift/ctrl
key, it gets multi selected and previous selected row doesn't get deselected.
My question is : How to achieve single selection through keyboard similar to that of mouse?
EDIT : I opened this issue in gwt issues. I hope they respond to this.
Upvotes: 4
Views: 1710
Reputation: 64561
You have to use a custom selection event manager whose translator returns the appropriate value for the behavior you want from clearCurrentSelection
.
The default behavior is to always add/remove from selection from the keyboard, and use the control or meta key to toggle whether to clear the current selection when using the mouse.
Upvotes: 5