From 5db3b46e8edcaecccc3e3dd6ab2568bbe4d1f2fb Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Thu, 14 Jun 2012 09:29:27 +0100 Subject: [PATCH] Fix var error in fnSetFilteringDelay - just a warning, but good to tidy up --- api/fnSetFilteringDelay.js | 56 ++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/api/fnSetFilteringDelay.js b/api/fnSetFilteringDelay.js index 85e24ea..2a5ddf9 100644 --- a/api/fnSetFilteringDelay.js +++ b/api/fnSetFilteringDelay.js @@ -12,32 +12,34 @@ */ jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) { - var - _that = this, - iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay; - - this.each( function ( i ) { - $.fn.dataTableExt.iApiIndex = i; - var - $this = this, - oTimerId = null, - sPreviousSearch = null, - anControl = $( 'input', _that.fnSettings().aanFeatures.f ); - - anControl.unbind( 'keyup' ).bind( 'keyup', function() { - var $$this = $this; + var _that = this; + + if ( iDelay === undefined ) { + iDelay = 250; + } + + this.each( function ( i ) { + $.fn.dataTableExt.iApiIndex = i; + var + $this = this, + oTimerId = null, + sPreviousSearch = null, + anControl = $( 'input', _that.fnSettings().aanFeatures.f ); + + anControl.unbind( 'keyup' ).bind( 'keyup', function() { + var $$this = $this; - if (sPreviousSearch === null || sPreviousSearch != anControl.val()) { - window.clearTimeout(oTimerId); - sPreviousSearch = anControl.val(); - oTimerId = window.setTimeout(function() { - $.fn.dataTableExt.iApiIndex = i; - _that.fnFilter( anControl.val() ); - }, iDelay); - } - }); - - return this; - } ); - return this; + if (sPreviousSearch === null || sPreviousSearch != anControl.val()) { + window.clearTimeout(oTimerId); + sPreviousSearch = anControl.val(); + oTimerId = window.setTimeout(function() { + $.fn.dataTableExt.iApiIndex = i; + _that.fnFilter( anControl.val() ); + }, iDelay); + } + }); + + return this; + } ); + return this; };