We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

bug pivot save report

the save report event is activated at the beginning of the component, there is some way that is activated only when you click on the save button. This is the code that I refer to https://slshda.run.stackblitz.io.

3 Replies

SN Sivamathi Natarajan Syncfusion Team January 24, 2020 12:32 PM UTC

 
Thanks for contacting Syncfusion Support. 
 
As per the behavior of pivot table, the initially loaded report will be saved in data base (here it is local storage) then the reports available in the data base will be listed in a dedicated drop-down list in toolbar panel. So, the “saveReport” event is triggered initially. If you don’t want to save your report on initial rendering, then you can restrict it with the help of below code example. 
 
let isSaveReportInitial: boolean = false; 
  saveReport(args: any) { 
    if (isSaveReportInitial) { 
      let reports = []; 
      let isSaved: boolean = false; 
      if (localStorage.pivotviewReports && localStorage.pivotviewReports !== "") { 
        reports = JSON.parse(localStorage.pivotviewReports); 
      } 
      if (args.report && args.reportName && args.reportName !== '') { 
        reports.map(function (item: any): any { 
          if (args.reportName === item.reportName) { 
            item.report = args.report; isSaved = true; 
          } 
        }); 
        if (!isSaved) { 
          reports.push(args); 
        } 
        localStorage.pivotviewReports = JSON.stringify(reports); 
      } 
    } 
    else { 
      (this.pivotObj.toolbarModule as any).currentReport = ""; 
      isSaveReportInitial = true; 
    } 
  } 
 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Sivamathi. 



AF anthony florez January 27, 2020 02:22 PM UTC

all good, I already resolved, thanks


SN Sivamathi Natarajan Syncfusion Team January 28, 2020 11:14 AM UTC

Hi anthony, 
 
Thanks for the response. Please get in touch with us if you would require any further assistance.  
 
Regards, 
Sivamathi. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon