changing the maximum pagination length

changing the maximum pagination length

gniquilgniquil Posts: 2Questions: 0Answers: 0
edited August 2009 in General
Hi All,

I wanted to show the user the table with pagination but with all entries on the first page, but couldn't find out how. So i hacked the code a bit and you will be able to do the following:
[code]
$('#my_table').dataTable({
...,
"iDisplayLength": <?= $max_count?>,
"iMaxPageLength": <?= $max_count ?>
})
[/code]

In order to do this you need to make the following 3 changes to the .js:

line 641:
[code]
this.iMaxPageLength = this.iDisplayLength;
[/code]

line 2248:
[code]
'All'+
[/code]

line 3328:
[code]
if ( typeof oInit.iMaxPageLength != 'undefined' ) {
oSettings.iMaxPageLength = oInit.iMaxPageLength;
}
[/code]

Replies

  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi gniquil,

    Thanks for the code! In 1.5 you can just set iDisplayLength to -1 to display all records. Have a look at http://datatables.net/usage/i18n#oLanguage.sLengthMenu for an example for how the length menu can be caused to help accommodate this.

    Regards,
    Allan
  • gniquilgniquil Posts: 2Questions: 0Answers: 0
    Oh Cool. I didn't see this at all. I guess I didn't really think this particular feature would be under language. Anyway, your library is really awesome. Thanks for all the hard work.
This discussion has been closed.