Datatable clear filtering

Here is how to clear all filtering in datatable.

function fnResetAllFilters() {
  var oSettings = oTable.fnSettings();
  for(iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) {
    oSettings.aoPreSearchCols[ iCol ].sSearch = '';
  }
  oTable.fnDraw();
}

So to clear just one filter, do:

function reset_filter_with_index(iCol){
  var oSettings = oTable.fnSettings();
  oSettings.aoPreSearchCols[ iCol ].sSearch = '';
  oTable.fnDraw();
}

Ref link: http://www.datatables.net/forums/discussion/997/fnfilter-how-to-reset-all-filters-without-multiple-requests./p1

4 thoughts on “Datatable clear filtering

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s