Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Is there a way to update Report object without setReport()?

Answered
Toni Laukka asked on May 12, 2020

We have build a custom addon to add styling to individual cells and we store this styling information on customFields to persist the styling in our DB. When we mount Flemxonster we read the styles from customFields and apply them with flexmonster.customizeCell. If we change the style we run the customizeCell again. The problem is when we want save this changed report flexmonster.getReport() returns the Report Object with old customFields. If we set the new data with flexmonster.setReport({…report, customFields}) every time after styling has changed it re-renders the whole report. UpdateData() works, but just for data. I want to update the whole report object without re-rendering, so that flexmonster.getReport() would give me up to date report object data.

1 answer

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 13, 2020

Hello, Toni,
 
Thank you for your question.
 
Our team would like to kindly explain that the only option to update the customFields property is the execution of the setReport method. In its turn, the setReport API call entails reloading of the data set and rendering of the component.
 
Therefore, we suggest separating the reports and appropriate information about the formatting after the report is loaded to the page. For example, it is possible to retrieve the customFields object and assign it to the local variable or another appropriate storage.
 
Every time the formatting needs to be changed, the mentioned variable can be updated without the need to change the report itself.
 
In case the formatting needs to be saved to your database (for example, right before the user closes the page), the report can be retrieved using the getReport API call, completed with the data from the mentioned variable, and saved.
 
We hope such an approach works well for you.
Please contact us in case additional questions arise.
 
Best regards,
Illia

Please login or Register to Submit Answer