Get Free Trial

Reset flexmonster columns,filters without calling data api again

Abhilash asked on December 15, 2020

When the user removes/add some columns. Currently I have a button called reset report to bring it to initial state and the code is


This is calling the data api again because in i have dataUrl specified. How do i avoid this? and just reset/update only the columns and filters without the need of calling Data API again

3 answers

Vera Didenko Vera Didenko Flexmonster December 16, 2020

Thank you for writing to us.
For updating the slice settings (columns, rows, etc.), we kindly recommend using the runQuery() API call
With this approach, only the report slice will get reset. 
We have prepared a JSFiddle for illustration:
Please let us know if this works fine for you.
Looking forward to your reply.
Kind regards, 

Abhilash December 21, 2020

How about the existing filters? They’re not getting reset
this is the jsfiddle example you sent me. try to filter category with anything and click reset slice. It only resets sorting, adding/removing columns but not filtering

Vera Didenko Vera Didenko Flexmonster December 22, 2020

Thank you for your response. 
You are right. The runQuery() API call doesn’t reset the filters.
For resetting the filters, we kindly suggest using the setFilter() API call.
Please see the modified version of the JSFiddle:
In the example, filters are reset as well using the described approach.
We would like to mention that if no filters are applied in the initial report configuration, you could use the clearFilter() API call as an alternative approach.
Please let us know if this works. 
Looking forward to your reply. 
Kind regards, 

Please login or Register to Submit Answer