Skip to content Skip to sidebar Skip to footer

Scroll To Specific Row In Datatable Api

I need to scroll until specific row in my datatable like this: https://datatables.net/extensions/scroller/examples/initialisation/api_scrolling.html This is my code:

Solution 1:

I think instead of "scrollY":"120px", it should be "scrollY":"120". try without px.

Solution 2:

I think the problem is probably with your use of 'this'. In this case, I think it actually references the callback function, and not the DataTable. I'm not sure if you could pass it as a parameter to the callback function somehow, but if you create a reference to the DataTable outside the callback function's scope, you can access it by that variable.

Solution 3:

Kindly replace with the below initComplete function. It will work.

"initComplete": function () {
    $('#example').DataTable().row(2).scrollTo();
}

Note: 2 represents n-1 targetted row

Post a Comment for "Scroll To Specific Row In Datatable Api"