ColumnfilterWidgets Reset Filters
ColumnfilterWidgets Reset Filters
Hi, I am using Columngilterwidgets.
I am using reset filters button for it which will reset all the set filtered terms on click
$.fn.dataTableExt.oApi.fnResetAllFilters = function (oSettings, bDraw) {
for(iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) {
oSettings.aoPreSearchCols[ iCol ].sSearch = '';
}
$('.filter-term').remove();
oSettings.oPreviousSearch.sSearch = '';
if(typeof bDraw === 'undefined') bDraw = true;
if(bDraw) this.fnDraw();
}
// button click event
$("button").click(function(e){
e.preventDefault();
// 'myDataTable' is the name you gave the datatable at initialisation - oTable or similar
$('#example').dataTable().fnResetAllFilters();
});
But issue i am facing is this code is just resets the table and removes the filter term but , the filter term is still in the asFilters. how can i reset the asFilters?