Search code examples
javascripttabulator

Tabulator: How to trigger the filter after data is edited/changed


Tabulator version: 4.6.3

Assume the following:

  1. Data is loaded successfully into table.

  2. Column "status" only knows two values: 1 and 2

  3. When header filter is applied with e.g. value 1, everything works nice: rows with status unlike 1 are hidden. As you would expected.

  4. When I edit the status of one record to 2 it is stored in database via ajax call but the filter is not working as you would expect: the "old" row is not automatically hidden, you can still see it with new value 2 among all the other rows with value 1.

  5. You have to trigger the filter again manually to make the row disappear.

What can I do? I can't find a function to trigger the filter with current filter values.


Solution

  • To trigger the filter again you can use a combination of the getFilters and setFilter function:

    table.setFilter(table.getFilters());