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