GWT - Datagrid: single keyboard selection when multiple selection is enabled

When I enable the keyboard selection policy and multiple selection on the DataGrid , I am faced with this problem.

Case 1 : multi-selection using the mouse and keyboard

When I want to select more than one row with the mouse, I hold the Ctrl or Shift and it works fine. Through the default keyboard, this action is provided by spacebar . When I want to sequentially select the Shift and spacebar key combinations does the trick.

Case 2 : single selection using the mouse and keyboard (the problem starts here)

When I want to select a single row with the mouse, I just do left click . If I do not hold any of the Ctrl Shift keys and do a left click , even if several lines are selected, it will be canceled and only the current line will be selected. This is the expected behavior, and I have no problem with it.

But the same thing is not implemented from the keyboard. Unable to select one line from the keyboard. If I spacebar , the line will be selected, and if I press the spacebar button spacebar on another line without the shift/ctrl key, it will be selected several, and the previous selected line will not be canceled.

My question is : How to achieve a single choice using a keyboard similar to a mouse keyboard?

EDIT : I discovered this problem in gwt issues . I hope they respond to this.

+4
source share
1 answer

You must use a custom select event dispatcher , the translator returns the appropriate value for the behavior you want from clearCurrentSelection .

the default behavior is to always add / remove from the selection from the keyboard and use the control or meta key to switch whether to clear the current selection when using the mouse.

+5
source

All Articles