View Full Version : Events.RowClick doesn't register right mouse button

16 Dec 2009, 10:22 AM
I have a grid where a lot of buttons are reacting based on which row(s) in a grid that is/are selected. I also have added a context menu.

Events.RowClick doesn't react on right mouse button (rmb) so I can't get any grid data for the context menu.

Events.RowMouseDown works fine with the rmb and with single-selection but doesn't handle CTRL-left mouse click or multiselection and is quite useless for me.

I can't register both events. Any suggestions?


grid.addListener(Events.RowClick, new Listener<GridEvent<ModelData>>() {
public void handleEvent(GridEvent<ModelData> ge) {
List<MyModel> models = grid.getSelectionModel().getSelectedItems();

17 Dec 2009, 1:58 AM
An update on this. You can get the context menu to work with Events.RowClick as long as you first click on the row with left mouse button and then with the right mouse button.

The problem still remains with the right click though. click on any other row with the rmb and it looks like you have selected another row. The grid hasn't registered this and until you click with lmb again, the grid selection that is shown is incorrect.

17 Dec 2009, 2:01 AM
The RowClick event is an onclick even and so is for leftclick.

17 Dec 2009, 3:39 AM
Yes, I understand this, but when using a context menu in a grid it gets very confusing when the right click which provides the menu doesn't register an event for clicking on the row.

I'll need to catch the event that triggers the context menu and add the logic (toggleButtons(models)) there as well if possible.

A correction for I wrote earlier:
Grid selection is still correct when using a right click with RowClick.

It's just if you have buttons/menus reacting to the grid by being enabled/disabled, they'll be out of sync with the grid if you right click.

17 Dec 2009, 3:43 AM
There is a selectionchange event on the selectionmodel that is probably better for your needs

17 Dec 2009, 4:31 AM
Yes, that handles both buttons. Perfect! Many thanks :o)