4

I have a datatable of about 90 rows long. The user performs some operation and the table must scroll to the corresponding row.

I know about the scroller plugin, but the user has demanded to have no pagination.

2 Answers 2

5

You can use the code below to scroll page to particular row if you're not using scrolling:

var table = $('#example').DataTable({
   paging: false
});

var $row = $(table.row(30).node());   
$('html, body').animate({ scrollTop: $row.offset().top }, 2000);

See this example for code and demonstration.

Sign up to request clarification or add additional context in comments.

Comments

0

My solution, where 'table' is datatable, and target row has 'shown' class:

var $row = $(".shown");
table.context[0].nScrollBody.scrollTo(0,($row[0].offsetTop));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.