开发者

How to differentiate between scrollbar click events and scrollbar drag events?

开发者 https://www.devze.com 2022-12-26 20:43 出处:网络
I need to scroll an EXT-GWT grid by some custom amount instead of the default 1-2 rows. Since I couldn\'t find any parameter that let me do this, I overrode the event handler to capture scroll or mous

I need to scroll an EXT-GWT grid by some custom amount instead of the default 1-2 rows. Since I couldn't find any parameter that let me do this, I overrode the event handler to capture scroll or mousewheel events. On any such event, I just programmatically move the scroller further by the required amount in the same direction, keeping a flag to ensure that it doesn't go into an infinite loop.

However, this technique fails when the user scrolls the grid with the scroller. Specifically, when I drag the scroller from some position to the top of the scroll track, the rows displayed in the grid are not the topmost rows in the grid but some rows further down. I figured that if I could differentiate between t开发者_如何学JAVAhe events generated by the scroll-up and scroll-down buttons and those generated by scroller drag, I could handle them separately and rectify the issue.

Any way this could be done? Or is there a way to specify the amount by which a scrollbar should scroll in one step?

Thanks

-Sameer


You could cheat, and if after scrolling scrollTop is 0, just go to the beginning. A bit ugly, but will solve that specific case, if it is the only one not working.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号