how to use the scroll event or scrolling event in server side

asked 2018-04-04 11:28:19 +0800

Dato gravatar image Dato
3 1

In my system, i want to add event listener to the component,like this:

div.addEventListener(Events.ON_SCROLL, new EventListener<ScrollEvent>() {

then i check the zk, the div component cannot support the onScrolling event or onScroll event.

Class HtmlBasedComponent:
* <p>Events:<br/>
 *  onClick, onDoubleClick, onRightClick, onDrop,
 *  onMouseOver, onMouseOut, onOK, onCacnel, onCtrlKey and onSwipe.<br/>

what should i do that the scroll event can work normally???

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-11 15:01:42 +0800

cor3000 gravatar image cor3000
3853 1 7
ZK Team

the onScroll event is only implemented for a few components e.g. ScrollPane / Slider

If you want it for a <div> you have to be careful since you might get more than you wish for. Smooth scrolling results in quite a large number of scroll events sending all of them to the server side might result in poor performance.

Here an example http://zkfiddle.org/sample/29r82g4/2-scroll-div-example implementing a scrolldiv prototype, just to show how to get started.

Please have a look an decide if that's useful for your case.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2018-04-04 11:28:19 +0800

Seen: 8 times

Last updated: Apr 11