Grid issue with Javascript "scrollToIndex"

Hi. As far as I know, the Grid method “scrollTo” from Vaadin 8 is not implemented in Vaadin Flow. In order to get the same result, was suggested to call Javascript function “scrollToIndex”. Something like:
“UI.getCurrent().getPage().executeJavaScript(”$0._scrollToIndex($1)“, grid, index);”

But when I use this code, and start adding rows to the grid one by one with the “scrollToIndex” targeting the last row added, only the too last rows of the grid are shown. The attached images show the result. Each picture represents an add action.
17523763.png
17523766.png
17523769.png
17523772.png

But when I use this code, and start adding rows to the grid one by one

When you add rows, do you call dataProvider.refreshAll() after row has been added?

I’ve tried “dataProvider.refreshAll()”, but didn’t work. Here, a very simple app that shows the problem.
17524703.zip (27.8 KB)

I have the same problem with grid under Vaadin 14. It seems that there are some bug in javascript flow which remove first row after call scrollToIndex. Method “dataProvider.refreshAll()” doesn’t help. Do you have any idea where is problem and how to fix it?

Hi,

this looks like this problem. There is a workaround:

https://github.com/vaadin/vaadin-grid/issues/1857

https://vaadin.com/forum/thread/18213846/strange-behaviour-using-grid-scrolltoend-vaadin-4-1-x

But there is another problem so maybe you must use the workaround from this post:

https://github.com/vaadin/vaadin-grid/issues/1808

https://vaadin.com/forum/thread/18447912/possible-regression-in-new-grid-scroll-implementation

Regards

It works. Thnx