Synchronize horizontal scrolling of two grids?

I’d like to have two grids; A parent on top and and a child below. Both will have the same columns. When I horizontally scroll one of them, I’d like to automatically scroll the other one as well. Is that possible in Vaadin8?

Without trying it, I’d imagine it’s possible but requires a custom GWT add-on / extension

And it might be that extension already exists GridScrollExtension Add-on - Vaadin Add-on Directory

The add-on gives you event to listen, which is fired when user scrolls the Grid

Thanks. I’ll check it out

Finally got around to checking it out. Using GridScrollExtension 2.5.1 with Vaadin 8.14.3:

Grid parent = createGrid(“parent”);
Grid child = createGrid(“child”);

GridScrollExtension parentExtension = new GridScrollExtension<>(parent);
GridScrollExtension childExtension = new GridScrollExtension<>(child);

parentExtension.addGridScrolledListener(event → {
childExtension.setScrollPosition(parentExtension .getLastXPosition(), parentExtension .getLastYPosition());
});

addComponents(parent, child);

Worked like a charm :slightly_smiling_face:

We still have some challenges, since our framework generates v7 compatibility Grid, and this add-on only supports the regular V8 Grid, but I think I can work around that.