Directory

← Back

Grid Scroller

Grid Scroller

Author

Rating

Popularity

<100

A utility addon that provides a simply api to read and set the scroll position. The utility can be used with a wrapped grid or via static methods.

Sample code

Grid<?> grid = new Grid<>();
// ... init grid

// specify the scroll values, e.g. from a previous view state
double topScroll = 100.0;
double leftScroll = 37.0;

// Set the scroll positions

GridScroller gridScroller = new GridScroller(grid);
gridScroller.scrollTop(topScroll);
gridScroller.scrollLeft(leftScroll);

// Alternatively you can call

gridScroller.scroll(leftScroll, topScroll);

// If you do not want to wrap the grid, use the static API

GridScroller.scrollTop(grid, topScroll);
Grid<?> grid = new Grid<>();
// ... init grid

GridScroller gridScroller = new GridScroller(grid);

// readPosition reads the position from the client side and passes it to a callback

gridScroller.readScrollPositions(scrollPosition -> 
    result.setText(scrollPosition.getLeft() + "," + scrollPosition.getTop()))
    
// If you do not want to wrap the grid, use the static API

GridScroller.readScrollPositions(grid, scrollPosition -> 
    result.setText(scrollPosition.getLeft() + "," + scrollPosition.getTop()))

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

Removed test classes from distribution. Those were accidentally added by the integration tests. Updated Vaadin version to latest 14.

Released
2022-07-20
Maturity
TESTED
License
Apache License 2.0

Compatibility

Framework
Vaadin 14+
Browser
N/A

Grid Scroller - Vaadin Add-on Directory

Grid Scroller Grid Scroller - Vaadin Add-on Directory
A utility addon that provides a simply api to read and set the scroll position. The utility can be used with a wrapped grid or via static methods.
Online