javascriptuser-interfacedatatablefilteringwebix

Reset Webix datatable filter


I have a quite confusing question. I have a Webix datatable and trying to reset a filter (richSelectFilter) for a column. But it's acting not as I've expected. I tried

$$("table1").getFilter("title").config.value = "";        

But nothing happens. Another attempt:

$$("table1").getFilter("title").config.value = "";        
$$("table1").refreshColumns();

And filter was disappeared while values are still filtered!

Here's a short code snippet: http://webix.com/snippet/b34607aa

Am I doing something wrong? Will appreciate any help.


Solution

  • Try to use

    $$("table1").getFilter("title").setValue("");
    

    Here's a snippet http://webix.com/snippet/3eb45109

    While you code will be correct for normal richselect control, filters in a datatable store the actual values in the column's config object. So you need to change it there, or just use the setValue API which will change value and will refresh the grid in the necessary way.