Move scroll bar to first row when clicking next/ previous - datatables
Move scroll bar to first row when clicking next/ previous - datatables
bbarani
Posts: 32Questions: 0Answers: 0
I am using datatables for displaying data in grid, everything works fine except for one issue (cosmetic issue).
When users go to end of page 1(now the scroll bar is at the end of the grid) and when they click any of the pagination button (next / previous / first / last), the scroll bar doesnt go back to top instead it stays same position where it was in previous page. Is there a way to reset the scrollbar position?
Thanks,
Barani
When users go to end of page 1(now the scroll bar is at the end of the grid) and when they click any of the pagination button (next / previous / first / last), the scroll bar doesnt go back to top instead it stays same position where it was in previous page. Is there a way to reset the scrollbar position?
Thanks,
Barani
This discussion has been closed.
Replies
I tried the below suggestion, but doesn't seem to work....
$("#"+elementId+"_last").click(function(){
window.scrollTo(0, $('#'+elementId).offset().top)
});
$("#"+elementId+"_first").click(function(){
window.scrollTo(0, $('#'+elementId).offset().top)
});