default table display length and options
default table display length and options
I am just starting to use datatables. It is fantastic. I would like to be able to pass the number of entries select box as an array so I can customize the display length options. Also passing the default display length would be good - let me set it rather than hard code it at 10 - 20 or 25 is often better than 10.
I have hacked these changes into my version of datatables - but it's not production quality.
I have hacked these changes into my version of datatables - but it's not production quality.
This discussion has been closed.
Replies
There has been a previous post on here about this. Not sure where it is tho. Here is the solution for what you wanted that has been adopted by some.
around line 926 ish (in with the setting variables) enter the following:
[code]
/*
* Variable: aPaginationLengths
* Purpose: The different lengths available for pagination
* Scope: jQuery.dataTable.classSettings
*/
this.aPaginationLengths = [10,25,50,100];
[/code]
in _fnFeatureHtmlLength ( oSettings ) change the select box to be this:
[code]
var sStdMenu =
'';
for( var i=0 ; i
Yup - there is actually a method to do this in DataTables already. If you using the internationalisation option oLanguage.sLengthMenu ( http://datatables.net/usage/i18n#oLanguage.sLengthMenu ) you can give it whatever values you want (even -1 which is a magic "show all" value).
Regards,
Allan
Thanks for the 'Show All' option in menu. It's really helpful.
Regards,
Yogesh