DataTables logo DataTables

via Ad Packs
Double AJAX request with Scroller and bStateSave?
  • I'm using DataTables 1.9.0 with the bundled Scroller extra. I'm getting my table contents from the server via AJAX, and I have enabled bStateSave. All of this works just fine except that when I scroll down and then click a link in the table and then hit the »Back« button in the browser, I'm getting kicked back to the beginning of the table instead of ending up with the same part of the table visible as before clicking the link.

    When looking at the XHR requests by means of the Google Chrome development tools, I notice that DataTables makes two XHR requests in a row. The first one appears to ask for the correct region of the table, while the second one asks for the start of the table. The result of the second one ends up being displayed. According to the Chrome network timeline, the second XHR request is started very quickly after the first, long before the first returns any results.

    Here's my configuration:
    var table;
    $(document).ready(function () {
      table = $('#threads').dataTable({
        sScrollY: "400px",
        sDom: "frtiS",
        bServerSide: true,
        bStateSave: true,
        bDeferRender: true,
        sAjaxSource: "/archive/threads/<% list.address %>", /* Perl Template Toolkit syntax */
      })
    });
    

    Does anyone know what is going on?
  • 1 Comment sorted by
  • There was a small error in Scroller that was causing this I'm afraid. I've just committed a fix, which you can download as the Scroller nightly (1.0.2.dev) from the downloads page: http://datatables.net/download/

    Thanks very much for letting me know about this issue!

    Allan

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion