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: 20,296Questions: 26Answers: 4,768
    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,143Questions: 1Answers: 2,586
    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.