TreeGrid scrollToIndex

Hello! I’am using Vaadin 14. The method scrollToIndex doesn’t work correctly!

Hi, could you describe in more detail how it behaves, i.e. what is not working correctly and possibly add some example code?

I can confirm that issue… if you initially expand the root items via code and also try to set the scroll index (e.g. scrollToIndex(4)) of a TreeGrid, there’s a render bug, where the top rows are displayed as empty (see screenshot before_sort.png). After sorting everything is displayed again.


Hi Christian,

I can give you some more information on that:

You should try the latest (LTS 14.4.9) or current version because the team did fix some problems regarding scrolling in the last few months, eg.:

The last one also looks like your bug and it was fixed some weeks ago. Mostly it works now but there is a bug left for deeper tree hierarchies. See my comment in the last ticket.

Depending on your exact bug you’re hit there may be workarounds:

grid.getElement().executeJs(“setTimeout(function() { $0.scrollToIndex($1) })”, grid.getElement(), i);


UI.getCurrent().beforeClientResponse(grid, ctx → grid.scrollToIndex(i));


If you still have problems, please create a new bug. I’m glad to be not the only one having and reporting those bugs :slight_smile:


I created a new ticket for that:

Thank you for the effort… I just requested a bug fix priority for that ticket, jfyi