Grid: Get row number of item

In Grid:

With a given item (my bean) - how can I get the number of the row, in which this item is displayed?


Since Framework version 8.4.0 ([release notes]
( the Grid.ItemClick<T> event ([Grid.ItemClick doc]
( also contains the row index information of the clicked item, but I don’t think there is a way to get the row index of a bean without that.


before that we had a ugly workaround :frowning:

we hat

private List<Item> items;
private Grid<Item> grid;

as a Class Fields.

in the initialisation method we filled the List with items and had


onclick we allways had the item from click Event
earlier something ugly like (Item) event.getSource().getValue() i think with modern Vaadin the Event is parametrised, so we simply get event.getValue()

then we used items.indexOF(event .. get Value ..);

so i am VERY thankfull, that since Vaadin 8.4 we can refactor this :slight_smile: ! ! !