Need a special offer?Find out if your project fits.
+

Is it possible to change the layout to flat when exporting to csv without refreshing the whole report?

Answered
talha asked on March 28, 2021

I used setOptions to change the grid type to flat, but it refreshed the whole report before exporting.

this is the code

let options = this.pivot.flexmonster.getOptions();
options.grid.type = 'flat';
this.pivot.flexmonster.setOptions(options);

8 answers

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster March 29, 2021

Hi!
 
Thank you for posting your question.
 
Due to the structure of the component, it is necessary to refresh the pivot table for the new options to take effect.
 
Perhaps you could tell us a bit more about your use case so that we can provide a more relevant solution if one exists?
 
Looking forward to your response.
 
Best regards,
Mykhailo

Public
talha March 29, 2021

I want to export CSV reports in a flat layout.

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster March 30, 2021

Hi Talha,
 
Our apologies for the delayed response.
 
In this case, there is not much we can recommend – as I've previously mentioned, refreshing the pivot table is necessary after using the setOptions() API call.
 
If you don't want your Flexmonster instance to change merely for exporting, consider the following workaround: create a copy of your Flexmonster instance, configure it for exporting, perform the export and then remove the copy from the page. 
 
Please let us know if there is anything else we can help you with.
 
Kind regards,
Mykhailo

Public
talha March 30, 2021

I like this workaround, could you please provide a fiddle on how to do it right?

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster March 31, 2021

Talha,
 
Please see the following JSFiddle sample illustrating the suggested approach: https://jsfiddle.net/flexmonster/9v2xdoyn/.
 
Do you think something like this would work for you?
 
We would be happy to hear your feedback.
 
Regards,
Mykhailo

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster April 7, 2021

Hi Talha,
 
How are you?
 
Just checking in to ask if you've found our sample helpful. Does this approach work fork for you?
 
Please let us know your thoughts.
 
Best regards,
Mykhailo

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster April 14, 2021

Talha,
 
Hope you're doing well!
 
Have you had a chance to check out the sample we've sent you earlier? Was it helpful?
 
We'd be happy to know what you think.
 
Best regards,
Mykhailo

Public
talha April 16, 2021

It created another flexmonster below the original flexmosnter, so I used the approach of going back to the compact layout like this

1-change to flat
2-export as flat 
3-go back to compact
Thank you tho, it was a great idea.

Please login or Register to Submit Answer