How to disable a filter while exporting?
How to disable a filter while exporting?

Hi,
I've a resultset of N rows, which I display using a filter (since some rows need to be just exported):
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex, originalData) {
var selectedValue = 1;
var dataValue = parseInt(originalData["IsLastLevel"]) || 0;
if (isNaN(selectedValue) || dataValue == selectedValue) {
return true;
}
return false;
}
);
So I get M (<N) rows displayed. Not, when I export, I'd like to include them in the export. How can I disable the filter only for export? Or how would you manage this situation? (also because the "info-box" alert the user that there are "more" rows, which is not so good)
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
See if this example helps:
https://datatables.net/reference/type/selector-modifier
I think you will need to use
search: 'none'
to export all rows.Kevin
@kthorngren: the problem is that this will disable "all filters" I have, not only that one specific. That's the major problem...
You can use
buttons.buttons.action
for this. See the last example for how to do this and execute the clicked export button.Kevin
I think I've got this way:
So: when I export, I disable the specifed filter, redraw, than export. When its finished, I restore filter, and I redraw table.
A bit of overhead, but I think that's the only solution?