changing the maximum pagination length
changing the maximum pagination length
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]
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]
This discussion has been closed.
Replies
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