We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Would like to download few columns only while exporting to pdf, csv, excel, html

Answered
shilpi asked on April 16, 2020

Hi Team,
 
I am successfully able to integrate flexmonster. However, I would like to know how can I download only few columns while doing export. In my grid I have 30 columns, but while download I want only 10 to be present with no impact on grid.
 
Regards
Shilpi

5 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster April 16, 2020

Hello, Shilpi,
 
Thank you for your question.
 
We would like to kindly explain that all information chosen for the current report will be exported.
In case only its part should be exported, the configuration can be changed in an appropriate way before exporting.
 
One of the possible approaches is to apply such changes right before the exporting is started and roll them back after export is complete.
It is possible to track those processes using the exportstart and exportcomplete events.
You are welcome to find out more about the mentioned events from our documentation:

 
We hope it helps.
Do not hesitate to contact us in case of additional questions.
 
Kind regards,
Illia

Public
shilpi April 18, 2020

Hi Illia,
 
How to call these methods in angular?
Do they need to be called from onPivotReady() method or we can pass from html like

<fm-pivot #pivot [licenseKey]="flexmonsterKey" 
            [report]="report"
            [toolbar]="toolbar"
            (beforetoolbarcreated) =  "customizeToolbar($event)"
            (ready)="onPivotReady($event)"
            (reportcomplete) = "reportcomplete($event)"
            (exportstart) = "exportstart($event)"
            >
</fm-pivot>

Can you please demonstrate as per angular, how to call the methods and filter the columns.

Public
shilpi April 20, 2020

H Illia,
Any update on above request?. It is bit urgent, I have to remove few columns before export starts.
Regards
Shilpi

Public
shilpi April 21, 2020

Please help us to provide solution in angular. How to remove column while export.
Awaiting for your response.
Thanks

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster April 21, 2020

Hello, Shilpi,
 
Thank you for giving us some time.
 
We would like to kindly draw your attention to the following code snippet:

exportHandler(): void {
    const slice = <Flexmonster.Slice> this.pivot.flexmonster.getReport().slice;
    this.pivot.flexmonster.on("aftergriddraw", () => {
      this.pivot.flexmonster.off("aftergriddraw");
      this.pivot.flexmonster.exportTo("pdf", {}, () => {
        this.pivot.flexmonster.runQuery(slice);
      })
    });
    this.pivot.flexmonster.runQuery({
      ...
    });
  }

 
It allows exporting the grid right after required columns were excluded using the runQuery method (marked in bold). After the export is finished, the previous slice is applied.
 
We hope it works.
You are welcome to contact us in case of additional questions.
 
Kind regards,
Illia

Please login or Register to Submit Answer