You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But the problem i am facing now is that my filters are not getting reset. The filter select-list from which i choose filter-term , on click of ResetAllFilters button these terms don't get reinserted into the select-list of that filter.
// 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();
});
The text was updated successfully, but these errors were encountered:
// reset
$.fn.dataTableExt.oApi.fnFilterClear = function (oSettings) {
var i, iLen;
/* Remove global filter */
oSettings.oPreviousSearch.sSearch = "";
/* Remove the text of the global filter in the input boxes */
if (typeof oSettings.aanFeatures.f != 'undefined') {
var n = oSettings.aanFeatures.f;
for (i = 0, iLen = n.length; i < iLen; i++) {
$('input', n[i]).val('');
}
}
/* Remove the search text for the column filters - NOTE - if you have input boxes for these
* filters, these will need to be reset
*/
for (i = 0, iLen = oSettings.aoPreSearchCols.length; i < iLen; i++) {
oSettings.aoPreSearchCols[i].sSearch = "";
}
/* Redraw */
oSettings.oApi._fnReDraw(oSettings);
};
Hi, I used the code of ResetAllFilters from
#1
But the problem i am facing now is that my filters are not getting reset. The filter select-list from which i choose filter-term , on click of ResetAllFilters button these terms don't get reinserted into the select-list of that filter.
What i am doing wrong?
Here is the code.
$.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();
});
The text was updated successfully, but these errors were encountered: