Search code examples
javascripttabulator

Tabulator - How to Clear a Selector Filter


I'm wondering how is it possible to clear a Filter using a Selector as used on the Interactive Demo for the Gender header.


Solution

  • If you are asking how to add an empty option to a select header filter, then you just need to include a property in the headerFilterParams property with the value of an empty string:

    {title:"Favourite Color", field:"color",   headerFilter:"select", headerFilterParams:{"":"", "red":"red", "green":"green"}}
    

    If you want to trigger it programatically from outside the table then you can call setHeaderFilterValue on the column component

    table.getColumn("color").setHeaderFilterValue("");