1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-01 13:24:10 +01:00

Fix: Custom length menu was broken

- If you provided your own <select> list for the lenght language option,
  DataTables would still append its own and ignore your custom one

- See thread 20548
This commit is contained in:
Allan Jardine 2014-04-25 16:43:02 +01:00
parent 505a2b37a3
commit 78b043d234
2 changed files with 8 additions and 8 deletions

View File

@ -1 +1 @@
94a1eb9efabca609076f75f8fc4ce05fdc00f6d4 ef259f6640c878bdad5a88706cdf16657e2a74d7

View File

@ -3197,14 +3197,14 @@
div[0].id = tableId+'_length'; div[0].id = tableId+'_length';
} }
// This split doesn't matter where _MENU_ is, we get three items back from it
var a = settings.oLanguage.sLengthMenu.split(/(_MENU_)/); var a = settings.oLanguage.sLengthMenu.split(/(_MENU_)/);
div.children() div.children().append( a.length > 1 ?
.append( a[0] ) [ a[0], select, a[2] ] :
.append( select ) a[0]
.append( a[2] ); );
select // Can't use `select` variable, as user might provide their own select menu
$('select', div)
.val( settings._iDisplayLength ) .val( settings._iDisplayLength )
.bind( 'change.DT', function(e) { .bind( 'change.DT', function(e) {
_fnLengthChange( settings, $(this).val() ); _fnLengthChange( settings, $(this).val() );
@ -3213,7 +3213,7 @@
// Update node value whenever anything changes the table's length // Update node value whenever anything changes the table's length
$(settings.nTable).bind( 'length.dt.DT', function (e, s, len) { $(settings.nTable).bind( 'length.dt.DT', function (e, s, len) {
select.val( len ); $('select', div).val( len );
} ); } );
return div[0]; return div[0];