Directory

← Back

GridScrollExtension Add-on

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

Author

Rating

Popularity

100+

Features

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: https://github.com/vaadin/framework/issues/10638

Get actual size of Grid

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

Events

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.

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Version 2.5.1

  • Fix: Column widths should be reported also when ColumnResizeCompensationMode is NONE.
Released
2021-08-11
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.10
Vaadin 7.7+ in 1.0.0
Vaadin 7.6+ in 1.1.1
Vaadin 8.0+ in 2.0.0
Browser
N/A

GridScrollExtension Add-on - Vaadin Add-on Directory

Simple extension to get, set and restore Grid scroll position in pixels and couple of other helpers. GridScrollExtension Add-on - Vaadin Add-on Directory
## Features ### 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: https://github.com/vaadin/framework/issues/10638 ### Get actual size of Grid getWidth(), getHeight() get actual width and height of Grid ### Events 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.
Online