|Re: Right click to select cell [message #1103397 is a reply to message #1103383]
||Fri, 06 September 2013 18:22
| desis machino
Registered: May 2013
Ive tried this approach in the following manner:
I am using the DefaultGridLayer with my NatTable. The DefaultGridLayer uses a DefaultBodyLayerStack which holds a SelectionLayer that is created with the default settings (uiBindings to listen to mouse left clicks events for selection logic).
I want to also allow users to right click to select cells, so in my layer (which extends the DefaultGridLayer), I've used addConfiguration to add a custom configuration (which extends AggregateConfiguration) in which I use addConfiguration to add a custom IConfiguration where in the configureUiBindings method, I've copied the code in DefaultSelectionBindings (in configureBodyMouseClickBindings) and basically replaced bodyLeftClick with bodyRightClick.
This is now working for me. Is this the correct way to implement such behavior?
But one thing that occurs is that the mouse click does not get propogated to open the context menu that I've configured.
What I would like to do is allow users to add bookmarks to rows on the grid. And they do so via a context menu option. And what I'd like, is if a user scrolls to a row they want, that they can just right click (without having to first left click to select the cell), and have the cell selected, and then the context menu open where they can choose to bookmark the row.
But when I implement as I've indicated above, the cell will be selected but the context menu will no longer open.
If I am doing this correctly and there is no way to get the context menu to appear, should I instead, select the cell from the context menu logic, where I could find the row/col position based on the mouse click event position and then continue the processing of the context menu?
Powered by FUDForum
. Page generated in 0.01508 seconds