GridScrollExtension Add-on | Vaadin

Simple extension to get, set and restore Grid scroll position in pixels and couple of other helpers.


Remember scroll position in TabSheet

Grid doesn't yet have server side getters and setters for scroll position. This extension adds those. In addition that it is able to cache the latest known scroll position. The main motivation for writing this add-on is to make Grid maintain its scroll position during Tab changes when used inside the TabSheet layout component. See demo application how it works.

Get actual column widths

There is also also getColumnWidth(..) method to get actual column widths of the Grid.

Compensate Column resizing side effects

Use getColumnResizeCompensationMode(ColumnResizeCompensationMode.RESIZE_GRID) method to get actual column widths of the Grid and setAutoResizeWidth(..) to Grid to automatically adjust width according to column widths. If automatic mode is not wanted or there is need to force Grid to resize due corner cases adjustGridWidth() API can be used.

Use getColumnResizeCompensationMode(ColumnResizeCompensationMode.RESIZE_COLUMN) to auto adjust the last Column to occupy the remaining space (if any).

See also:

Get actual size of Grid

getWidth(), getHeight() get actual width and height of Grid


Events: GridRenderedEvent, GridResizedEvent, GridScrolledEvent and GridColumnsResizedEvent

There are corresponding addXXXListener methods. GridRenderedEvent is fired when initial column calculation is ready (real column widths are available after this). Other events should be useful also in various special cases.


Link to this version
BetaReleased 11 August 2021Apache License 2.0
Framework Support
Vaadin 8.10
Also supported:
Vaadin 7 (1.1.1)
Install with
Release notes - Version 2.5.1

Version 2.5.1

  • Fix: Column widths should be reported also when ColumnResizeCompensationMode is NONE.