Munendra
Munendra

Reputation: 33

Vaadin 8 grid multiple selection model get row on event

I am using multiple row selection in vaadin 8 grid, I need an event that gives me the selected row object upon clicking the selection checkbox not the row click.

Upvotes: 3

Views: 527

Answers (1)

Tatu Lund
Tatu Lund

Reputation: 10643

You should use grid.addSelectionListener(..) for this. SelectionEvent is fired each time you change selection, i.e. click the checkbox in case of multiselection model. In case SelectionEvent is instance of MultiSelectionEvent you can get the last added selection

https://vaadin.com/download/release/8.3/8.3.3/docs/api/com/vaadin/event/selection/MultiSelectionEvent.html#getNewSelection--

Or removed selection

https://vaadin.com/download/release/8.3/8.3.3/docs/api/com/vaadin/event/selection/MultiSelectionEvent.html#getRemovedSelection--

Upvotes: 2

Related Questions