$.fn.dataTable.ext.search.push
$.fn.dataTable.ext.search.push
rf1234
Posts: 2,982Questions: 87Answers: 421
Hi!
I ran into the same problem as described here: https://datatables.net//forums/discussion/comment/90255/#Comment_90255
settings.nTable.id didn't really work, I didn't find it. What I did is this:
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
//we only do this for the second table
if (settings.sTableId === 'tblInboxOfferGov') {
var ok;
ok = filterShowNMonths(data, ixUpdateTime);
if (ok) {
return filterDeleted(data, ixDelete);
} else {
return ok;
}
} else {
return true;
}
}
);
Is there a better way to do this? Or is that what you would also recommend? Will settings.sTableId be around for a while?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Found a better solution. In a different example I saw that you are also passing the database row to the function above. For that reason I changed my approach. I am no longer working with the search data (which is a nuisance anyway because this only works if you know the field index which changes when you change the field sequence in the table) but I work with the row data. Don't need settings.sTableId any longer.
This is what it looks like right now:
Hi, could you tell me where they come from and what they are
settings, data, dataIndex, row, counter
Here is the doc for the search plugin:
https://datatables.net/manual/plug-ins/search
Kevin