Filters do not work at the same time
Filters do not work at the same time
lvk
Posts: 2Questions: 1Answers: 0
Hello, 8 filters for 4 columns. But do not work at the same time. Please tell me how to solve the problem?
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) {
let startF, endF, val;
if (Raiko.SEO.filterType == "Sum") {
startF = parseInt($('#startSum').val(), 10);
endF = parseInt($('#endSum').val(), 10);
val = parseFloat(data[1]) || 0;
}
if (Raiko.SEO.filterType == "Traffic") {
startF = parseInt($('#startTraffic').val(), 10);
endF = parseInt($('#endTraffic').val(), 10);
val = parseFloat(data[2]) || 0;
}
if (Raiko.SEO.filterType == "Percent") {
startF = parseInt($('#startPercent').val(), 10);
endF = parseInt($('#endPercent').val(), 10);
val = parseFloat(data[3]) || 0;
}
if (Raiko.SEO.filterType == "Position") {
startF = parseInt($('#startPosition').val(), 10);
endF = parseInt($('#endPosition').val(), 10);
val = parseFloat(data[4]) || 0;
}
if ((isNaN(startF) && isNaN(endF)) ||
(isNaN(startF) && val <= endF) ||
(val >= startF && isNaN(endF)) ||
(val >= startF && val <= endF)) {
return true;
}
return false;
}
);
This discussion has been closed.
Answers
How to know if a filtered line? I wanted to compare the elements in the filtered array with original. But it's not working:
It shouldn't appear in the table. Another option would be to use the API to get the filtered out rows:
table.rows( { search: false } ).nodes()
Happy to take a look at a test case showing the issue.
Allan