DataTables individual column filter few seconds delay to trigger the search

DataTables individual column filter few seconds delay to trigger the search

irajacicirajacic Posts: 1Questions: 1Answers: 0
edited June 2014 in Free community support

I have managed to setup global column filter delay with fnSetFilteringDelay.

  jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
    var _that = this;

    if ( iDelay === undefined ) {
        iDelay = 500;
    }

    this.each( function ( i ) {
        $.fn.dataTableExt.iApiIndex = i;
        var
            $this = this,
            oTimerId = null,
            sPreviousSearch = null,
            anControl = $( 'input', _that.fnSettings().aanFeatures.f );

            anControl.unbind( 'keyup search input' ).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;
};

How to make individual columns to work..
I have posted this question also on stackoverflow.
http://stackoverflow.com/questions/24136122/datatables-server-side-column-filter-search-delay

Answers

This discussion has been closed.