DataTables 1.10.2 and "lengthMenu" option

DataTables 1.10.2 and "lengthMenu" option

ssomenzissomenzi Posts: 2Questions: 1Answers: 0

when I set the lenghtMenu with: "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ] the first 3 options work fine, the last one (-1) does not show all the table rows but the first 10 (as if it was using the "pageLength" option default).

This is my code:

$(document).ready(function() {

   $('#example').dataTable( {

       "processing": true,

       "serverSide": true,

       "ajax": "get_all_rows",

       "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ]

   } );

} );

what am I doing wrong?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Answer ✓

    "serverSide": true,

    Does your server-side processing script cope with receiving -1 as the paging length and return all records?

    Allan

  • ssomenzissomenzi Posts: 2Questions: 1Answers: 0

    Dear allan,

    that was exactly the problem. Thanks for pointing me in the right direction.
    All fine now

This discussion has been closed.