Closed mateddy closed 6 years ago
I quickly realized that it might not a good idea for ajaxFiltering... my program makes two ajax request instead of one.
Hey @mateddy
you can pass an array into the addFilter function to add multiple filters in one go, you could also just pass an array with one object into the function:
$("#example-table").tabulator([{field:"age", type:">", value:52}]);
I hope that helps,
Cheers
Oli :)
Actually I wish to be more convenient in replacing filters. At this moment I need to search, remove and add new filter.
Currently the function accept three parameters: field, type and value: $("#example-table").tabulator("addFilter", "age", ">", 22); $("#example-table").tabulator("removeFilter", "age", ">", 22);
Is it possible to have it accept one parameter (object) with three properties? $("#example-table").tabulator("addFilter", {field:"age", type:">", val:"22");
If so it would be more convenient to modify existing ilter as follows: let f = $("#example-table").tabulator("getFilters").find(e => e.field == "age"); $("#example-table").tabulator("removeFilter", f); f.value = 30; $("#example-table").tabulator("addFilter", f);