Vaadin-grid: Row Click Event in vaadin-grid polymer

Created on 13 Dec 2018  路  2Comments  路  Source: vaadin/vaadin-grid

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

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-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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings