Selecting Item in Grid programmatically does not scroll to it

Hello,

I’ve got a problem with the Vaadin Grid in Vaadin 14.
Above the grid there are serveral buttons to select the next/previous entry in the grid as well as the first and last entry.
For that purpose I am using the Grid.select(Object obj) - Method to select a specified entry inside the grid.
This works well for selecting, but unfortunately the grid isnt scrolling automatically, if the selected entry is outside the visible part.

It sounds like a bug at the Grid-component, doesnt it?
Any ideas?

Kind regards,
Maik Blümel

There is a scrollToIndex method, but it expects an item index. This is a particular case of https://github.com/vaadin/vaadin-grid/issues/1154 Indeed, the case of “scroll to selected” is discussed [there]
(https://github.com/vaadin/vaadin-grid/issues/1154#issuecomment-449053892): it’s not possible to implement that feature for the general case (since the index may be unknown in the case of lazy data providers)

Hi Javier,
thanks for the reply. I’ve read the issue-thread and understand why it is diffucult to implement this method for a lazy data provider case.
But my problem is not, that I want to scroll to an item which is not yet displayed or loaded from the backend. The item, which I would like to jump to is the next item in grid which is loaded yet (I can see the items with chrome developer tools in html) but not yet visible, because it is outside the visible grid frame.
So, the behaviour of the Vaadin 8 grid was, that if this selection happened, the grid scrolls up/down a row. So the item is again inside visible grid frame.

Kind regards,
Maik