Saving scroller position on first data chunk

Saving scroller position on first data chunk

chtcht Posts: 14Questions: 0Answers: 0
edited May 2014 in Scroller

Hi Allan,

I'm using Datatables 1.10.0 and Scroller 1.2.1 with stateSave, serverSide and ajax. I have a problem saving the scroller position on the first chunk of data.

My testsystem is:
Your login is: allan / 1234

Debug information:
(collected with my development system, because the https-testsystem was blocked out of mixed content reason.)

To see the issue do the following:

  • After login you will be taken to a page called "Mandators - selection".
  • Scroll down just a little bit (e.g. to dataset "TESTMA130") so the table doesn't need to load new data from the server.
  • Click on "TESTMA130" an hit the back button. The table is scrolled to the top and not to "TESTMA130".
  • After that scroll all the way down. The reload of data takes place but then, the scroller flips to the position for "TESTMA130" and not to the bottom of the table.

I hope, you can follow my description. If you need more information to analyze this, please let me know.

Thanks again for the great plugin and for your work here.



  • chtcht Posts: 14Questions: 0Answers: 0
    edited May 2014


    since i couldn't make any progress on this issue, i would kindly like to ask, if somebody else could have a look at this.

    I tried to debug myself, but the only thing i could see is, that during the first draw in function _fnScrollDraw the variables settings.bSorted and settings.bFiltered are always set to true, when ever there was the first chunk of data (iDisplayStart:0) requested in the ajax-request. Even when the position of the scrollbar was not at the very top.

    if ( settings.bSorted || settings.bFiltered ) {
      divBodyEl.scrollTop = 0;

    This leads to the effect that the table is scrolled to the very top.

    If you scroll further down, new data has to be loaded from the server and iDisplayStart is higher than zero. In this case in the same function _fnScrollDraw the settings.bSorted and settings.bFiltered are set to false, which leaves the scrollbar in place.

    If you need more information, please let me know.

    Kind regards,

  • chtcht Posts: 14Questions: 0Answers: 0

    To see all parts of the issue mentioned in my first post, your browser window must be smaller than 900 px. Otherwise there might be no reload of data from the server.

  • allanallan Posts: 61,609Questions: 1Answers: 10,088 Site admin

    HI Christian,

    Thanks for the details in your post here and the example - it really helped. I've just sent you an e-mail, but if anyone else is reading this, I've just committed a fix to Scroller that resolves this problem. In sort, Scroller and server-side processing weren't really playing too well together, and there was an issue with state saving and the new virtual scrolling implementation.

    The latest code is available from: .

    Interested to hear how you get on with it!


  • chtcht Posts: 14Questions: 0Answers: 0

    Hi Allan,
    Looks like your fix for Scroller (1.2.2dev) works like a charm! We will make some more tests with bigger amounts of data. If we see any more issues, we will let you know.

    But for now i'm absolutely happy and the money for your quick support seems to be well spent.

    For everybody having similar problems: just get the latest versions of DataTables and Scroller!

    Regards, Christian

This discussion has been closed.