Scroller

Scroller is a virtual rendering plug-in for DataTables which allows large datasets to be drawn on screen every quickly. What the virtual rendering means is that only the visible portion of the table (and a bit to either side to make the scrolling smooth) is drawn, while the scrolling container gives the visual impression that the whole table is visible. This is done by making use of the pagination abilities of DataTables and moving the table around in the scrolling container DataTables adds to the page. The scrolling container is forced to the height it would be for the full table display using an extra element.

Example initialisation of Scroller with DataTables:

/*
 * Example initialisation
 */
$(document).ready(function() {
    $('#example').dataTable( {
        "ajax": "myData.txt",
        "scrollY": "200px",
        "dom": "frtiS",
        "deferRender": true
    } );
} );

Note that rows in the table must all be the same height. Information in a cell which expands on to multiple lines will cause some odd behaviour in the scrolling. Additionally, the table's cellspacing parameter must be set to 0, again to ensure the information display is correct.

Scroller is initialised by simply including the letter S in the domDT for the table you want to have this feature enabled on. Note that the S must come after the t parameter in sDom.

Key features include:

  • Speed! The aim of Scroller for DataTables is to make rendering large data sets fast
  • Full compatibility with DataTables' deferred rendering for maximum speed
  • Display millions of rows in a scrollable table
  • Integration with state saving in DataTables (scrolling position is saved)
  • Easy to use

Example

ID First name Last name ZIP / Post code Country