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

Fix: When updating the filtering input control, we would just match on INPUT elements, so if the developer had appended an input button to the filter wrapper, that value would also be changed - 8537. Now a reference to the input element is stored and used to update the input value (this method means we don't need to add another class option, and developers can change to 'type=search' if they wish).

This commit is contained in:
Allan Jardine 2012-02-15 09:36:51 +00:00
parent 431b5e8a55
commit af2e153bc3
3 changed files with 16 additions and 6 deletions

View File

@ -1954,7 +1954,12 @@
nFilter.id = oSettings.sTableId+'_filter';
}
var jqFilter = $("input", nFilter);
var jqFilter = $('input[type="text"]', nFilter);
// Store a reference to the input element, so other input elements could be
// added to the filter wrapper if needed (submit button for example)
nFilter._DT_Input = jqFilter[0];
jqFilter.val( oPreviousSearch.sSearch.replace('"','"') );
jqFilter.bind( 'keyup.DT', function(e) {
/* Update all other filter input elements for the new display */
@ -1963,7 +1968,7 @@
{
if ( n[i] != $(this).parents('div.dataTables_filter')[0] )
{
$('input', n[i]).val( this.value );
$(n[i]._DT_Input).val( this.value );
}
}
@ -5380,7 +5385,7 @@
var n = oSettings.aanFeatures.f;
for ( var i=0, iLen=n.length ; i<iLen ; i++ )
{
$('input', n[i]).val( sInput );
$(n[i]._DT_Input).val( sInput );
}
}
}

View File

@ -656,7 +656,7 @@ this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseIns
var n = oSettings.aanFeatures.f;
for ( var i=0, iLen=n.length ; i<iLen ; i++ )
{
$('input', n[i]).val( sInput );
$(n[i]._DT_Input).val( sInput );
}
}
}

View File

@ -23,7 +23,12 @@ function _fnFeatureHtmlFilter ( oSettings )
nFilter.id = oSettings.sTableId+'_filter';
}
var jqFilter = $("input", nFilter);
var jqFilter = $('input[type="text"]', nFilter);
// Store a reference to the input element, so other input elements could be
// added to the filter wrapper if needed (submit button for example)
nFilter._DT_Input = jqFilter[0];
jqFilter.val( oPreviousSearch.sSearch.replace('"','&quot;') );
jqFilter.bind( 'keyup.DT', function(e) {
/* Update all other filter input elements for the new display */
@ -32,7 +37,7 @@ function _fnFeatureHtmlFilter ( oSettings )
{
if ( n[i] != $(this).parents('div.dataTables_filter')[0] )
{
$('input', n[i]).val( this.value );
$(n[i]._DT_Input).val( this.value );
}
}