aLengthMenu not working in 1.9

aLengthMenu not working in 1.9

edited February 2012 in DataTables 1.9 Posts: 1
I'm overriding DataTables defaults like this:

$.extend( true, $.fn.dataTable.defaults, { "bDestroy": true, "bAutoWidth": false, "iDisplayLength": 100, "aLengthMenu": [[100, 200, 500, 1000], [100, 200, 500, 1000]], "sPaginationType": 'bootstrap' });
But then the item length dropdown includes these options:

100,200,500,-1
100,200,500,All
200
100

Obviously the first two make no sense.

Replies

  • Posts: 21,554
    Hi,

    You don't want it doing a deep copy here (the first parameter given to 'extend') since it will combine your array with the DataTables default array, thus causing the problem. If you just drop the true it will work okay: http://live.datatables.net/axirac/edit .

    If you do need to do a deep copy in future, then you would need to do something like this:

    $.extend( true, $.fn.dataTable.defaults, { "bDestroy": true, "bAutoWidth": false, "iDisplayLength": 100, "sPaginationType": 'bootstrap' }); $.fn.dataTable.defaults.aLengthMenu = [[100, 200, 500, 1000], [100, 200, 500, 1000]];
    Allan
This discussion has been closed.