Lines 110-165
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique,
Link Here
|
110 |
// These keys must not launch filtering |
110 |
// These keys must not launch filtering |
111 |
var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40); |
111 |
var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40); |
112 |
|
112 |
|
113 |
// Set a filtering delay for global search field |
|
|
114 |
jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) { |
115 |
/* |
116 |
* Inputs: object:oSettings - dataTables settings object - automatically given |
117 |
* integer:iDelay - delay in milliseconds |
118 |
* Usage: $('#example').dataTable().fnSetFilteringDelay(250); |
119 |
* Author: Zygimantas Berziunas (www.zygimantas.com) and Allan Jardine |
120 |
* License: GPL v2 or BSD 3 point style |
121 |
* Contact: zygimantas.berziunas /AT\ hotmail.com |
122 |
*/ |
123 |
var |
124 |
_that = this, |
125 |
iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay; |
126 |
|
127 |
this.each( function ( i ) { |
128 |
$.fn.dataTableExt.iApiIndex = i; |
129 |
var |
130 |
$this = this, |
131 |
oTimerId = null, |
132 |
sPreviousSearch = null, |
133 |
anControl = $( 'input', _that.fnSettings().aanFeatures.f ); |
134 |
|
135 |
anControl.unbind( 'keyup.DT' ).bind( 'keyup.DT', function(event) { |
136 |
var $$this = $this; |
137 |
if (blacklist_keys.indexOf(event.keyCode) != -1) { |
138 |
return this; |
139 |
}else if ( event.keyCode == '13' ) { |
140 |
$.fn.dataTableExt.iApiIndex = i; |
141 |
_that.fnFilter( $(this).val() ); |
142 |
} else { |
143 |
if (sPreviousSearch === null || sPreviousSearch != anControl.val()) { |
144 |
window.clearTimeout(oTimerId); |
145 |
sPreviousSearch = anControl.val(); |
146 |
oTimerId = window.setTimeout(function() { |
147 |
$.fn.dataTableExt.iApiIndex = i; |
148 |
_that.fnFilter( anControl.val() ); |
149 |
}, iDelay); |
150 |
} |
151 |
} |
152 |
}); |
153 |
|
154 |
return this; |
155 |
} ); |
156 |
return this; |
157 |
} |
158 |
|
159 |
// Add a filtering delay on general search and on all input (with a class 'filter') |
113 |
// Add a filtering delay on general search and on all input (with a class 'filter') |
160 |
jQuery.fn.dataTableExt.oApi.fnAddFilters = function ( oSettings, sClass, iDelay ) { |
114 |
jQuery.fn.dataTableExt.oApi.fnAddFilters = function ( oSettings, sClass, iDelay ) { |
161 |
var table = this; |
115 |
var table = this; |
162 |
this.fnSetFilteringDelay(iDelay); |
|
|
163 |
var filterTimerId = null; |
116 |
var filterTimerId = null; |
164 |
$(table).find("input."+sClass).keyup(function(event) { |
117 |
$(table).find("input."+sClass).keyup(function(event) { |
165 |
if (blacklist_keys.indexOf(event.keyCode) != -1) { |
118 |
if (blacklist_keys.indexOf(event.keyCode) != -1) { |
166 |
- |
|
|