Delay Multiple Field Filtering
Delay Multiple Field Filtering
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.
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.
This discussion has been closed.
Replies
[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]