[Scrolling] How to detect the scroll direction of HOT (up, down, left, right)

Hi There:
I am wondering if HOT has any API or properties so we can easily get to know if the table is scrolling up/down/left/right?
It seems current API hooks (afterScrollVertically ,e.g) does not care about the direction.
Our case is when user scroll down to the bottom or scroll right to the border, we will fire a AJAX call for more data to display.
We want to enforce the performance by only do the network request when the scrolling direction is down/right
I believe this should be a common use case.

Thanks
Stone.

2 Likes

Hi,

the afterScrollVertically is helpful but, as you said, it’s not enough to get the direction of scrolling. But if you use the getFirstVisibleColumn and getFirstVisibleRow it becomes possible.

Here’s a demo: http://jsfiddle.net/o7jt6nu3/

ps. I’ve added this as a feature proposition https://github.com/handsontable/handsontable/issues/5059

2 Likes

Thanks for the quick help, will try your proposal definitely!

1 Like