RedrawTop Calculation in _fnDrawCallback in Scroller Plugin is incorrect AND fix provided
RedrawTop Calculation in _fnDrawCallback in Scroller Plugin is incorrect AND fix provided
khirakawa
Posts: 4Questions: 0Answers: 0
Hello,
For our project we use the Scroller plugin with server-side processing.
We have noticed that the redrawTop calculation in _fnDrawCallback for the Scroller plugin is incorrect.
Here is the offending code:
[code]this.s.redrawTop = iScrollTop - (this.s.viewportHeight/2);[/code]
The redrawTop is calculated to be the scroll position less half the viewport height.
However, the delay between when fnDraw is called and when fnDrawCallback is called is enough for a user to move the scroll position outside the trigger range, and thus redrawTop is calculated to be less than iTableTop. The larger the delay (due to perhaps a slow server-side response), the easier it is for a user to run into this issue.
This behavior causes a white space to appear between the first row of fetched data (iTableTop) and the top trigger boundary (redrawTop).
Here is our fix.
[code] /* redrawTop should be from iTableTop and not iScrollTop. */
this.s.redrawTop = iTableTop + (this.s.viewportHeight/2);
[/code]
The redrawTop is always calculated to be within the table, just how redrawBottom is. No more white spaces. Yay!
Thanks,
Ken
For our project we use the Scroller plugin with server-side processing.
We have noticed that the redrawTop calculation in _fnDrawCallback for the Scroller plugin is incorrect.
Here is the offending code:
[code]this.s.redrawTop = iScrollTop - (this.s.viewportHeight/2);[/code]
The redrawTop is calculated to be the scroll position less half the viewport height.
However, the delay between when fnDraw is called and when fnDrawCallback is called is enough for a user to move the scroll position outside the trigger range, and thus redrawTop is calculated to be less than iTableTop. The larger the delay (due to perhaps a slow server-side response), the easier it is for a user to run into this issue.
This behavior causes a white space to appear between the first row of fetched data (iTableTop) and the top trigger boundary (redrawTop).
Here is our fix.
[code] /* redrawTop should be from iTableTop and not iScrollTop. */
this.s.redrawTop = iTableTop + (this.s.viewportHeight/2);
[/code]
The redrawTop is always calculated to be within the table, just how redrawBottom is. No more white spaces. Yay!
Thanks,
Ken
This discussion has been closed.
Replies