🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all hot features!
Get Free Trial

Reset flexmonster columns,filters without calling data api again

Answered
Abhilash asked on December 15, 2020

Hi,
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.pivot.flexmonster.setReport(this.report);

 
This is calling the data api again because in this.report 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

Public
Vera Didenko Vera Didenko Flexmonster December 16, 2020

Hello, 
 
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: http://jsfiddle.net/flexmonster/6g2oxb4u/.
 
Please let us know if this works fine for you.
Looking forward to your reply.
 
Kind regards, 
Vera

Public
Abhilash December 21, 2020

How about the existing filters? They’re not getting reset
http://jsfiddle.net/flexmonster/6g2oxb4u/
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

Public
Vera Didenko Vera Didenko Flexmonster December 22, 2020

Hello, 
 
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: http://jsfiddle.net/flexmonster/Lrtaxg9j/.
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, 
Vera

Please login or Register to Submit Answer