fnReloadAjax() avoid reseting scroll bar
fnReloadAjax() avoid reseting scroll bar
I have a table with about 50 rows of data. I'm using sAjaxSource to pull it from
server, though i'm not doing serverside processing. I also use the scrollbar feature.
I need to refresh the table every 5 secs. so I setup setInterval to run
fnReloadAjax().
the problem is, whenever the fnReloadAjax fires, the scrollbar gets reset to the beginning.
I think it's because fnReloadAjax destory the entire table and rebuild it. So the user loses his
place that he's scrolling down to.
Any suggestion how I can avoid the scroll bar being reset?
Thank you
server, though i'm not doing serverside processing. I also use the scrollbar feature.
I need to refresh the table every 5 secs. so I setup setInterval to run
fnReloadAjax().
the problem is, whenever the fnReloadAjax fires, the scrollbar gets reset to the beginning.
I think it's because fnReloadAjax destory the entire table and rebuild it. So the user loses his
place that he's scrolling down to.
Any suggestion how I can avoid the scroll bar being reset?
Thank you
This discussion has been closed.
Replies
Allan
and set it the the same way after the redraw complete.
$(".dataTables_scrollBody").scrollTop(scrollPos);
not the most elegant. but it does work.
Thanks!
Allan
I had more luck modifying the call to fnDraw() in the fnReloadAjax plugin to be fnDraw(false). This prevents resetting sort/search/etc and reloads the table content smoothly.