Setting aLengthMenu

Setting aLengthMenu

BobImperialBobImperial Posts: 3Questions: 0Answers: 0
edited December 2011 in General
Hi folks! I'm trying to set the default display to "All" but when I try it removes the select list from view. My default looks like this:
$(document).ready(function() {
$('#example').dataTable( {
"aLengthMenu": [[20, 50, 100, -1], [20, 50, 100, "All"]]
} );
} );
and works fine and dandy although when I change it to:
$(document).ready(function() {
$('#example').dataTable( {
"aLengthMenu": [[20, 50, 100, -1], ["All", 20, 50, 100]]
} );
} );
it does display all records when it loads, but the select disappears from view as does the alternating row colors that are set in the css file. Am I going about this wrong? Would greatly appreciate someone showing me how to accomplish this.

TIA Bob

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Bob,

    You need to set the initial paging length to -1: http://datatables.net/ref#iDisplayLength . The aLengthMenu parameter doesn't effect the initial value, only the values that the user can pick from.

    Allan
This discussion has been closed.