UI Builder: Add reset button to reset all selected filters

Kamini07
Tera Contributor

Hello--

 

This is from asset workspace and the I have been modifying it via UI builder. There are filters "All location", Region(newly added by me). So if I select any value in any one of these filter then it has to be clear using a external button. 

 

Here my requirement is to add a reset button component with the functionality that upon clicking the button, it should clear the selected filter beside it. Attaching screenshot for your reference.

 

What client state parameter or script or event has to achieve the above functionality.

 

Kamini07_4-1715260822917.png

 

 

 

Kamini07_3-1715260797091.png

 

Thanks in advance

@Community Alums 

@Marc Mouries 

@Dibyaratnam 

 

 

1 REPLY 1

Dibyaratnam
Tera Sage

@Kamini07 , Once you select the flter values, there would be some state property getting set in each of those filter. On click of the CLearAll button, you need to empty that state parameters.

 

api.setState('filter1', []);
    api.setState('filter2', []);
    api.setState('filter3', []);

 

It should work by this.

 

Also make sure to clear the parFilter state parameter as well.

 

Please mark as correct if it helps.