mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Merge pull request #160 from zeitiger/master
Refactor filter search from input[text] to input[search]
This commit is contained in:
commit
8d9e620ef2
8
media/js/jquery.dataTables.js
vendored
8
media/js/jquery.dataTables.js
vendored
@ -2158,8 +2158,8 @@
|
|||||||
|
|
||||||
var sSearchStr = oSettings.oLanguage.sSearch;
|
var sSearchStr = oSettings.oLanguage.sSearch;
|
||||||
sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
|
sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
|
||||||
sSearchStr.replace('_INPUT_', '<input type="text" />') :
|
sSearchStr.replace('_INPUT_', '<input type="search" />') :
|
||||||
sSearchStr==="" ? '<input type="text" />' : sSearchStr+' <input type="text" />';
|
sSearchStr==="" ? '<input type="search" />' : sSearchStr+' <input type="search" />';
|
||||||
|
|
||||||
var nFilter = document.createElement( 'div' );
|
var nFilter = document.createElement( 'div' );
|
||||||
nFilter.className = oSettings.oClasses.sFilter;
|
nFilter.className = oSettings.oClasses.sFilter;
|
||||||
@ -2169,14 +2169,14 @@
|
|||||||
nFilter.id = oSettings.sTableId+'_filter';
|
nFilter.id = oSettings.sTableId+'_filter';
|
||||||
}
|
}
|
||||||
|
|
||||||
var jqFilter = $('input[type="text"]', nFilter);
|
var jqFilter = $('input[type="search"]', nFilter);
|
||||||
|
|
||||||
// Store a reference to the input element, so other input elements could be
|
// Store a reference to the input element, so other input elements could be
|
||||||
// added to the filter wrapper if needed (submit button for example)
|
// added to the filter wrapper if needed (submit button for example)
|
||||||
nFilter._DT_Input = jqFilter[0];
|
nFilter._DT_Input = jqFilter[0];
|
||||||
|
|
||||||
jqFilter.val( oPreviousSearch.sSearch.replace('"','"') );
|
jqFilter.val( oPreviousSearch.sSearch.replace('"','"') );
|
||||||
jqFilter.bind( 'keyup.DT', function(e) {
|
jqFilter.bind( 'keyup.DT search.DT', function(e) {
|
||||||
/* Update all other filter input elements for the new display */
|
/* Update all other filter input elements for the new display */
|
||||||
var n = oSettings.aanFeatures.f;
|
var n = oSettings.aanFeatures.f;
|
||||||
var val = this.value==="" ? "" : this.value; // mental IE8 fix :-(
|
var val = this.value==="" ? "" : this.value; // mental IE8 fix :-(
|
||||||
|
@ -11,8 +11,8 @@ function _fnFeatureHtmlFilter ( oSettings )
|
|||||||
|
|
||||||
var sSearchStr = oSettings.oLanguage.sSearch;
|
var sSearchStr = oSettings.oLanguage.sSearch;
|
||||||
sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
|
sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
|
||||||
sSearchStr.replace('_INPUT_', '<input type="text" />') :
|
sSearchStr.replace('_INPUT_', '<input type="search" />') :
|
||||||
sSearchStr==="" ? '<input type="text" />' : sSearchStr+' <input type="text" />';
|
sSearchStr==="" ? '<input type="search" />' : sSearchStr+' <input type="search" />';
|
||||||
|
|
||||||
var nFilter = document.createElement( 'div' );
|
var nFilter = document.createElement( 'div' );
|
||||||
nFilter.className = oSettings.oClasses.sFilter;
|
nFilter.className = oSettings.oClasses.sFilter;
|
||||||
@ -22,14 +22,14 @@ function _fnFeatureHtmlFilter ( oSettings )
|
|||||||
nFilter.id = oSettings.sTableId+'_filter';
|
nFilter.id = oSettings.sTableId+'_filter';
|
||||||
}
|
}
|
||||||
|
|
||||||
var jqFilter = $('input[type="text"]', nFilter);
|
var jqFilter = $('input[type="search"]', nFilter);
|
||||||
|
|
||||||
// Store a reference to the input element, so other input elements could be
|
// Store a reference to the input element, so other input elements could be
|
||||||
// added to the filter wrapper if needed (submit button for example)
|
// added to the filter wrapper if needed (submit button for example)
|
||||||
nFilter._DT_Input = jqFilter[0];
|
nFilter._DT_Input = jqFilter[0];
|
||||||
|
|
||||||
jqFilter.val( oPreviousSearch.sSearch.replace('"','"') );
|
jqFilter.val( oPreviousSearch.sSearch.replace('"','"') );
|
||||||
jqFilter.bind( 'keyup.DT', function(e) {
|
jqFilter.bind( 'keyup.DT search.DT', function(e) {
|
||||||
/* Update all other filter input elements for the new display */
|
/* Update all other filter input elements for the new display */
|
||||||
var n = oSettings.aanFeatures.f;
|
var n = oSettings.aanFeatures.f;
|
||||||
var val = this.value==="" ? "" : this.value; // mental IE8 fix :-(
|
var val = this.value==="" ? "" : this.value; // mental IE8 fix :-(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user