I have the following Datatable :
I can change the status of a row by the toggle switch custom,
Now I'm trying to hide the rows with status = 0
So I tried the following code
var table = $('#example').DataTable();
$("#hide").click(function() {
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
return $(table.row(dataIndex).node()).attr('data-user') == 1;
}
);
table.draw();
});
$("#reset").click(function() {
$.fn.dataTable.ext.search.pop();
table.draw();
});
But doesn't work with me.