Remove all column and global filters applied to a table

  • Author: Allan Jardine
  • Deprecated: This plug-in has been deprecated and replaced with other functionality. Please see the detailed description below for more information.

Remove all filtering that has been applied to a DataTable, be it column based filtering or global filtering.

DataTables 1.10+ new API can achieve the same effect as this plug-in, without the requirement for plug-ins using the following chaining:

var table = $('#example').DataTable();
 .search( '' )
 .columns().search( '' )

Please use the new API in DataTables 1.10+ is you are able to do so.

Plug-in code

jQuery.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 );


This plug-in is available on the DataTables CDN:


Note that if you are using multiple plug-ins, it is beneficial in terms of performance to combine the plug-ins into a single file and host it on your own server, rather than making multiple requests to the DataTables CDN.

Version control

If you have any ideas for how this plug-in can be improved, or spot anything that is in error, it is available on GitHub and pull requests are very welcome!


$(document).ready(function() {
      var table = $('#example').dataTable();

      // Perform a filter
      table.fnFilter('Trident', 0);

      // Remove all filtering
  } );