Jake Pearson
Jake Pearson

Reputation: 27717

JQuery Datatables - Get Column Filter

Is there a way in JQuery Datatables to get the current filter status of a column? I am doing some custom filtering and have bStateSave set to true. When the page reloads I would like to read out the current filter state in order to populate a different portion on my page.

Upvotes: 1

Views: 4339

Answers (1)

WTPK
WTPK

Reputation: 1079

For anybody still looking (like I was):

    var oSettings = oTable.fnSettings();
    $("tfoot input").each(function(i){
        if(oSettings.aoPreSearchCols[i]['sSearch']!=''){
            $(this).val(oSettings.aoPreSearchCols[i]['sSearch']);
        }
    });
    if(oSettings.oPreviousSearch['sSearch']!=''){
        $('.search_field').val(oSettings.oPreviousSearch['sSearch']);
    }

taken from http://www.datatables.net/forums/discussion/992/solved-override-bstatesave-with-osearch-and-aosearchcols/p1

Upvotes: 6

Related Questions