How to reset the filters using a button?

How to reset the filters using a button?

Sunil KumarSunil Kumar Posts: 17Questions: 11Answers: 0

How to reset the filters using a button?

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954
    edited January 2020 Answer ✓

    Use search() and columns().search() with blank strings, for example:

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

    Kevin

  • Sunil KumarSunil Kumar Posts: 17Questions: 11Answers: 0
    edited January 2020

    I am using the older version of dataTable(small d).Please suggest any alternative solution to clear search keywords.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    That's not older, that just means you're not initialising an API instance. You can add api() to get an instance - see here.

    Colin

This discussion has been closed.