How to change the Show x entries

How to change the Show x entries

dyetubedyetube Posts: 20Questions: 5Answers: 0

I want to change the "Show x Entries" to this: 5 10 15 20 25 As in this:

http://imgur.com/a/y2rSG

How can this be accomplished? I tried to find something in lengthMenu but no luck.

This question has an accepted answers - jump to answer

Answers

  • dyetubedyetube Posts: 20Questions: 5Answers: 0

    Bump

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    This plug-in will do exactly that.

    Allan

  • dyetubedyetube Posts: 20Questions: 5Answers: 0
    edited August 2016

    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?

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    I'm afraid not. Can you link to a page showing the issue.

    Thanks,
    Allan

  • dyetubedyetube Posts: 20Questions: 5Answers: 0

    Unfortunately I cannot link to the page as I develop on my local computer.

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    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

  • dyetubedyetube Posts: 20Questions: 5Answers: 0

    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?

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    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

  • dyetubedyetube Posts: 20Questions: 5Answers: 0

    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!

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin
    Answer ✓

    I'm using version 1.9.4. Guess this is legacy

    It is yes. The parameter you used instead is the correct one for 1.9.

    Allan

This discussion has been closed.