I have a requirement where a user selects a row(or a cell, for that matter) and presses some key(such as Enter, this is configurable) and I need to take some action based on the key pressed (such as opening a dialog with detailed information about the row).
As I was looking in the code, I stumbled upon a key event handler in vaadin-grid-keyboard-navigation-mixin.html . But the _onKeyDown method handles only some specific keys. And I am not sure how to pass a callback to that function.
Any ideas regarding how this can be done. I just want to attach an key event handler to each cell, that capture the key event(again this is not fixed), and execute appropriate method.
I hope that I have been able to convey my intentions.
Thanks
Hi @sudipta1411 There's a new "Event Context" feature in <vaadin-grid> 5.3 that might suit your needs https://cdn.vaadin.com/vaadin-grid/5.3.0-alpha6/demo/#grid-event-context-demos
It basically works so that you add any type of an event listener to the grid and then use grid.getEventContext(e) to get detailed contextual information on the event.
Thanks for the quick reply. It works like a charm.
Most helpful comment
Hi @sudipta1411 There's a new "Event Context" feature in
<vaadin-grid>5.3 that might suit your needs https://cdn.vaadin.com/vaadin-grid/5.3.0-alpha6/demo/#grid-event-context-demosIt basically works so that you add any type of an event listener to the grid and then use
grid.getEventContext(e)to get detailed contextual information on the event.