Filter API Plugin

Filter API Plugin

elmezieelmezie Posts: 7Questions: 0Answers: 0
edited September 2009 in Plug-ins
When I copy and paste the FILTER API Plugin , i get a syntax error in it's code. Any ideas?

The error i get is

syntax error
});


jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
/*
* Type: Plugin for DataTables (www.datatables.net) JQuery plugin.
* Name: dataTableExt.oApi.fnSetFilteringDelay
* Version: 2.1.0
* Description: Enables filtration delay for keeping the browser more
* responsive while searching for a longer keyword.
* Inputs: object:oSettings - dataTables settings object
* integer:iDelay - delay in miliseconds
* Returns: JQuery
* Usage: $('#example').dataTable().fnSetFilteringDelay(250);
*
* Author: Zygimantas Berziunas (www.zygimantas.com) - original
* Allan Jardine v2.0.0
* vex (on the forums) v2.1.0
* Created: 7/3/2009
* Language: Javascript
* License: GPL v2 or BSD 3 point style
* Contact: zygimantas.berziunas /AT\ hotmail.com
*/
var _that = this;
this.each( function ( i ) {
$.fn.dataTableExt.iApiIndex = i;
iDelay = (iDelay && (/^[0-9]+$/.test(iDelay))) ? iDelay : 250;

var $this = this, oTimerId;
var anControl = $( 'input', _that.fnSettings().anFeatures.f );

anControl.unbind( 'keyup' ).bind( 'keyup', function() {
var $$this = $this;

if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
{
window.clearTimeout(oTimerId);

oTimerId = window.setTimeout(function() {
$.fn.dataTableExt.iApiIndex = i;
_that.fnFilter( anControl.val() );
}, iDelay);
}
});

return this;
} );
return this;
}

Replies

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin
    Hi elmezie,

    There was a spare '{' on the end of the line:

    [code]
    if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
    [/code]
    which was mucking things up. The plug-in code has been updated for this now - thanks for letting me know about the error!

    Regards,
    Allan
This discussion has been closed.