How to go to first record on datatable when fixed column and pagination is used?
How to go to first record on datatable when fixed column and pagination is used?
ekbordo
Posts: 12Questions: 8Answers: 0
Hello everyone;
I used pagination and fixed column in datatable. I would like to go to first record in the table when click to pagination button. Actually, without fixed columns, it works properly in below code. But when i use fixed column, it does not work. It scrolls outer one, not the inner(in datatable frame) scroll. Any idea?
Here my code:
var oldStart = 0;
"fnDrawCallback": function (o) {
if (o._iDisplayStart != oldStart) {
var targetOffset = $('#exampleTable').offset().top;
$('html,body').animate({ scrollTop: targetOffset }, 500);
oldStart = o._iDisplayStart;
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
When scrolling is enabled, the table is split into three components (or two if there is no footer). So you need to scroll the DataTables scrolling container. You can do that with:
Allan
thank you very much Allan. You save my life.