Delay Multiple Field Filtering

Delay Multiple Field Filtering

limscoderlimscoder Posts: 2Questions: 0Answers: 0
edited February 2011 in General
Hi,

Is there a way to delay filtering requests when filtering by several fields at once?

For example:

[code]
table.fnFilter(query, 0);
// widget sends xhr
table.fnFilter(query_1, 1);
// widget sends another xhr

// interface I would like to have:
table.fnFilter([
{
query: query,
col: 0
},
{
query: query_1,
col: 1
}
]);
// widget sends a single xhr
[/code]

I looked through the source code, and it looks like there is no way for me to implement it myself since the _fnFilterComplete function is private.

Replies

  • limscoderlimscoder Posts: 2Questions: 0Answers: 0
    I came up with a lame hack to do what I want:

    [code]
    var firstFilter = filters.shift();

    $.each(filters, function(idx, filter) {
    // Manually set search attributes
    var oSettings = table.dataTableSettings[0];
    oSettings.aoPreSearchCols[filter.colIdx].sSearch = filter.query;
    oSettings.aoPreSearchCols[filter.colIdx].bRegex = filter.regex;
    oSettings.aoPreSearchCols[filter.colIdx].bSmart = false;
    });

    // Send the query
    table.fnFilter(firstFilter.query, firstFilter.colIdx);
    [/code]
This discussion has been closed.