How to set and get pivot configuration?

Answered
Slopez asked on February 26, 2024

Hi, I need to get the last configuration that the user gives to the pivot table to persist it and avoid the reconfiguration when the user change between devices. Also I'm finding really hard to implement the "nested fields typed" when the nesting has several levels, there is some way other than the proposed here? https://jsfiddle.net/flexmonster/hr81n89w/ 
 

2 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster February 28, 2024

Hello, Slopez!

Thank you for reaching out to us.

Report saving

Flexmonster allows achieving this functionality by fulfilling the following steps:

  1. Retrieve and save the reports, either using the save or getReport method. The getReport() method returns a JSON report, allowing you to save this configuration in the desired way. The save() method allows sending the report to your server via a POST request (see examples). While the save() method approach encapsulates the logic of sending the JSON report to a server, using the getReport for this purpose will provide you with more freedom in implementation.
  2. In case you want to keep track of changes and save reports automatically, we recommend using the reportchange event. This event is fired on each change in the report, like applying filters, sorting, selecting different fields from the Field List, etc. By wrapping the report-saving logic into this event's handler, each change in the report would be saved with no need for users to save them manually.
    flexmonster.on('reportchange', function () {
      //Save the report here 
    });
  3. The saved reports can be later loaded by setting the report property in the Flexmosnter's constructor to the URL that returns the report in JSON format or by using the laod() API call.  


Hierarchies with several levels

Besides the approach illustrated in the given JSFiddle, Flexmonster also supports defining multilevel hierarchies in the separate mapping object, stored in the dataSource object. While the structure of mapping is the same as in the example you provided, these settings can be stored outside the data array. You are welcome to check the example: https://jsfiddle.net/flexmonster/yb20apuL/ 

We are looking forward to hearing your feedback.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster March 21, 2024

Hello, Slopez!

Hope you are doing well.
We are wondering if you had time to look through the information from our previous reply.
You are welcome to write us if any further questions arise.

Best Regards,
Maksym

Please login or Register to Submit Answer