Setting aLengthMenu
Setting aLengthMenu
BobImperial
Posts: 3Questions: 0Answers: 0
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
$(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
This discussion has been closed.
Replies
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