Skip to content Skip to sidebar Skip to footer

How To Load Table In Datatables And Have It Scroll To Last Record Automatically On Load

Problem : using dataTables javascript library to display data perfectly fine. Data is retrieved via PHP/mysql and then the table is drawn and the code cycles through the tables as

Solution 1:

If you use the Scroller extra, you can call the following in your initialization function:

"fnInitComplete": function() { 

    // Make sure you have your table stored to a variable// (here, I used oTable).  Then tell the Scroller to// scroll to an arbitrary large number beyond the // number of rows in your table.

    oTable.fnSettings().oScroller.fnScrollToRow(100000); 

    // Alternatively, if you know the number of rows in // your table at runtime, you could just feed in that// value to the Scroller.
}

Best of luck!

Solution 2:

try,

$(".dataTables_scrollBody").scrollTop(9999);

http://datatables.net/forums/discussion/19084/scroller-plugin-scroll-table-with-keypress

Post a Comment for "How To Load Table In Datatables And Have It Scroll To Last Record Automatically On Load"