cyberhobo / ColumnFilterWidgets

This is an add-on for the DataTables plugin for jQuery that creates filtering widgets based on the data in table columns.
69 stars 34 forks source link

Add an option to include a 'clear all filters' button #1

Open cyberhobo opened 12 years ago

cyberhobo commented 12 years ago

Suggested by Allan, the DataTables author.

Muhahe commented 11 years ago

with this, you can clear all filters, when binded on button

$.fn.dataTableExt.oApi.fnResetAllFilters = function (oSettings, bDraw/default true/) { 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(); }

BenCoding commented 11 years ago

That works nicely thanks!