aLengthMenu Issue
aLengthMenu Issue
I wanted to experiment with a dataTable, beginning with the default length menu which appears in the upper-left corner. By default, it displays "10, 25, 50, All." So, I tried changing it with the recommended code
[code]
// my table only contains 9 entries at the moment
$(document).ready(function(){
$('#friends_table').dataTable( {
"aaSorting": [[0, "asc" ]],
"bJQueryUI": true,
"iDisplayLength": 3,
// recommended modification
"aLengthMenu": [[3, 6, 9, -1], [3, 6, 9, "All"]],
"bLengthChange": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
} );
});
[/code]
But, despite this, the menu persists in displaying "10, 25, 50, All."
With a bit of looking, I've found another way of altering the length menu by nesting an "sLengthMenu" att. within an "oLangauge" att. like this :
[code]
"oLanguage": {
"sLengthMenu": 'Show 36All entries' },
[/code]
So, knowing this is good. But, it makes me all-the-more curious to understand why the recommended code for changing the menu length options is ineffective.
[code]
// my table only contains 9 entries at the moment
$(document).ready(function(){
$('#friends_table').dataTable( {
"aaSorting": [[0, "asc" ]],
"bJQueryUI": true,
"iDisplayLength": 3,
// recommended modification
"aLengthMenu": [[3, 6, 9, -1], [3, 6, 9, "All"]],
"bLengthChange": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
} );
});
[/code]
But, despite this, the menu persists in displaying "10, 25, 50, All."
With a bit of looking, I've found another way of altering the length menu by nesting an "sLengthMenu" att. within an "oLangauge" att. like this :
[code]
"oLanguage": {
"sLengthMenu": 'Show 36All entries' },
[/code]
So, knowing this is good. But, it makes me all-the-more curious to understand why the recommended code for changing the menu length options is ineffective.
This discussion has been closed.
Replies
Allan