RedrawTop Calculation in _fnDrawCallback in Scroller Plugin is incorrect AND fix provided

RedrawTop Calculation in _fnDrawCallback in Scroller Plugin is incorrect AND fix provided

khirakawakhirakawa Posts: 4Questions: 0Answers: 0
edited March 2012 in Bug reports
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

Replies

  • valenpovalenpo Posts: 13Questions: 0Answers: 0
    thanks for fix, have same fix today to. this is right and working. Behavior is when you go to another page and return with DataTable page, iTableTop always is wrong (negative like -273 )
This discussion has been closed.