How to display only a given number of lines, without pagination

How to display only a given number of lines, without pagination

trarothtraroth Posts: 5Questions: 2Answers: 0

I have a query returning about 2000 lines which I want to display in a DataTable. But I want display only the first 100, without any pagination. How could I do that?

When I use iDisplayLength=100, I get a pagination, of course. When I add bPaginate=false, it displays all the lines, regardless to the value of iDisplayLength...

This question has an accepted answers - jump to answer

Answers

  • RpiechuraRpiechura Posts: 98Questions: 3Answers: 14
    edited June 2014 Answer ✓

    From the legacy documentation

    Number of rows to display on a single page when using pagination. If feature enabled (bLengthChange) then the end user will be able to override this to a custom setting using a pop-up menu.

    So that is working correctly, if you turn off pagination it ignores iDisplayLength since that is only supposed to work when you have pagination turned on.

    That being said there is an easy way to turn it off, and it requires pagination to be on. When you declare the 'sDom' arugment just leave the 'P' off (IE "sDom":"lfrti"). If you decide that you want to also turn off the information ('showing x records of y out of z') than also take off the i. More information can be found at http://legacy.datatables.net/ref towards the bottom under sDom.

  • trarothtraroth Posts: 5Questions: 2Answers: 0

    Thank you, it perfectly resolved my issue.

This discussion has been closed.