Scroll to a row in Grid?

Is the scrollToRow method missing in V10 (Flow) Vaadin? Is there any other alternative?

This feature has not been implemented yet, there is feature request here

(Note: the example there is written in Kotlin, not Java)

The workaround is to peform JavaScript call via UI.getCurrent().getPage().executeJavaScript(“$0._scrollToIndex($index)”, element)

Hi Tatu,

Thank you very much indeed!

Should anybody need, here is my code that works fine:

class MyGrid extends Grid {



   private void scrollToBottom() {
             FileGrid.this, content.size() - 1);

The workaround does work, in that it scrolls to the given index in the displayed table. If I have a filter or sort order set on the grid, how can I get the correct index to scroll to?

In generic case scrollToItem() is more complex since you need to have item to row index translate function. This is missing feature in DataProvider, I have commented it here (its Vaadin 8, but DataProvider is somewhat indentical there)

In Vaadin 8 you could it with this kind of workaround

(which can be very expensive with lazy data providers, which is the reason why I am proposing a better solution in

The same is not possible with Flow due

Naturally if you happen to have ListDataProvider and no filtering and sorting, you do not need the above mentioned function and getting index is trivial.


Are there some news about the missing method “scrollToRow” for Vaadin 14.x?

I need this method, too.

With kind regards

Are there some news about the missing method “scrollToRow” for Vaadin 14.x?

Grid has scrollTo method introduced in Vaadin 14.1.

Thanks for the “scrollToRow” method.

But for DataProvider with lazy loading, filtering and sorting finding out the row gets tricky.

Could you suggest an approach for a “scrollToItem” method under those circumstances?

Something like this