aLengthMenu Issue

aLengthMenu Issue

trn_23trn_23 Posts: 5Questions: 0Answers: 0
edited January 2012 in General
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.

Replies

  • trn_23trn_23 Posts: 5Questions: 0Answers: 0
    I misspoke. the default menu displays 10,25,50,100.
  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    Your aLengthMenu command looks correct to me. What version of DataTables are you using?

    Allan
  • trn_23trn_23 Posts: 5Questions: 0Answers: 0
    1.7.2
  • trn_23trn_23 Posts: 5Questions: 0Answers: 0
    Sorry, I think I may be using 1.6.2
  • trn_23trn_23 Posts: 5Questions: 0Answers: 0
    Which was my issue! :) Thanks for pointing that out.
This discussion has been closed.