api to scroll to last row.
api to scroll to last row.
I am trying to make a table that has rows added every few seconds and would like the table to automatically scroll to the last row after each add (unless paused). (think tail) I am using the scroller extra, but this code does not seems to work:
[code]
oSettings.oScroller.fnScrollToRow( 9999999 )
[/code]
I originally tried using the row number of count of total rows and that did not work, so I just tried a really big number and that did not work either.
Also, if it tells you anything, I am tripping the glitch in scroller when rows wrap. So I might be at "Showing 431 to 416 of 416 entries" at the bottom.
Thanks
Paul.
[code]
oSettings.oScroller.fnScrollToRow( 9999999 )
[/code]
I originally tried using the row number of count of total rows and that did not work, so I just tried a really big number and that did not work either.
Also, if it tells you anything, I am tripping the glitch in scroller when rows wrap. So I might be at "Showing 431 to 416 of 416 entries" at the bottom.
Thanks
Paul.
This discussion has been closed.
Replies
[code]
LogGrid.processNext = function(json) {
var oSettings = LogGrid.fnSettings();
var scroller = LogGrid.parent()[0];
var oldTop = scroller.scrollTop;
var aData = oSettings.sAjaxDataProp(json);
/* Got the data - add it to the table */
if (aData.length > 0) {
for (i = 0; i < aData.length; i++) {
LogGrid.fnAddData(aData[i]);
}
if (oSettings.oFeatures.bSort) {
LogGrid.fnSort(oSettings.aaSorting);
}
if (LogGridTailing.attr('checked')) {
scroller.scrollTop = scroller.scrollHeight;
} else
scroller.scrollTop = oldTop;
}
}
[/code]
where LogGrid = $('#Log').dataTable( ... )