How to change the Show x entries
How to change the Show x entries
dyetube
Posts: 20Questions: 5Answers: 0
I want to change the "Show x Entries" to this: 5 10 15 20 25 As in this:
How can this be accomplished? I tried to find something in lengthMenu but no luck.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Bump
This plug-in will do exactly that.
Allan
I keep getting: Uncaught TypeError: Cannot read property 'push' of undefined When using this plugin. Here's my code:
ReportHistoryVar = $('#ReportListing').dataTable({
"alengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
dom: 'Lfrtip',
"bAutoWidth": false,
"oLanguage": {
"sZeroRecords": "@Text.Get(Text.eTextType.Label, "table_Empty")",
"sInfoEmpty": "@Text.Get(Text.eTextType.Label, "table_PaginationNoRecords")",
"sInfo": "@Text.Get(Text.eTextType.Label, "table_PaginationRecords")",
"sSearch": "@Text.Get(Text.eTextType.Label, "table_Search")",
@*"sLengthMenu": "@Text.Get(Text.eTextType.Label, "table_LengthMenu")"*@
"slengthMenu": [10, 25, 50, -1],
},
"aoColumnDefs": [{ "bSortable": true, "aTargets": [0], "sClass": "" },
{ "bSortable": true, "aTargets": [1], "sClass": "" }]
});
Any ideas why?
I'm afraid not. Can you link to a page showing the issue.
Thanks,
Allan
Unfortunately I cannot link to the page as I develop on my local computer.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
I'm afraid that without a test case there is little help I can offer you since I don't know what is going wrong.
Thanks,
Allan
So I did figure out that using $.fn.dataTable.ext.aoFeatures.push stops the error instead of $.fn.dataTable.ext.feature.push because there is no Feature array but there is an aoFeatures array. The plugin still doesn't work though. Not quite sure why and trying to debug but maybe you can help guide me armed with this new knowledge?
I guess you are using a legacy version of DataTables in that case. As you will be able to see in this example
$.fn.dataTable.ext.feature
is an array.Without a test case I can't say much more I'm afraid.
Allan
I'm using version 1.9.4. Guess this is legacy. I'll see about upgrading but it would be an effort as we use datatables on a lot of pages. Thanks for the help though!
It is yes. The parameter you used instead is the correct one for 1.9.
Allan