dataTables.filteringDelay.js - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
HTML git clone git://jay.scot/warvox
DIR Log
DIR Files
DIR Refs
DIR README
---
dataTables.filteringDelay.js (1308B)
---
1 jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
2 /*
3 * Inputs: object:oSettings - dataTables settings object - automatically given
4 * integer:iDelay - delay in milliseconds
5 * Usage: $('#example').dataTable().fnSetFilteringDelay(250);
6 * Author: Zygimantas Berziunas (www.zygimantas.com) and Allan Jardine
7 * License: GPL v2 or BSD 3 point style
8 * Contact: zygimantas.berziunas /AT\ hotmail.com
9 */
10 var
11 _that = this,
12 iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay;
13
14 this.each( function ( i ) {
15 jQuery.fn.dataTableExt.iApiIndex = i;
16 var
17 $this = this,
18 oTimerId = null,
19 sPreviousSearch = null,
20 anControl = jQuery( 'input', _that.fnSettings().aanFeatures.f );
21
22 anControl.unbind( 'keyup' ).bind( 'keyup', function() {
23 var $$this = $this;
24
25 if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
26 window.clearTimeout(oTimerId);
27 sPreviousSearch = anControl.val();
28 oTimerId = window.setTimeout(function() {
29 jQuery.fn.dataTableExt.iApiIndex = i;
30 _that.fnFilter( anControl.val() );
31 }, iDelay);
32 }
33 });
34
35 return this;
36 } );
37 return this;
38 }
39
40 /* Example call
41 $(document).ready(function() {
42 $('.dataTable').dataTable().fnSetFilteringDelay();
43 } ); */
44