Clearing search filter
Clearing search filter
cce1911
Posts: 12Questions: 4Answers: 1
I have 2 datatables on the same page. I have created a filter that hides rows from table 1 as they are added to table 2.
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
// if multiple tables are on the same page find the correct table
if(settings.sTableId != "shooters_table"){
return true;
} else {
// rowId is set during init. Must add # for the selector
var rid = '#'+ shootersTable.row(dataIndex).node().id;
if(matchShooterList.indexOf(rid) == -1 ){
return true;
} else {
return false;
}
}
}
);
shootersTable.draw();
Now I want to reset table 1 so I can see the all of the original rows. I created a button to do that, but the following code in the click event doesn't work.
shootersTable
.search( '' )
.columns().search( '' )
.draw();
I still get the filtered table. What am I missing here?
This discussion has been closed.
Answers
I finally found a solution that is detailed in this thread: https://datatables.net/forums/discussion/28347/remove-custom-filtering-after-use-fn-datatable-ext-search-push