|
1 | 1 | import { Component, ViewChild, inject } from "@angular/core"; |
2 | 2 |
|
3 | | -import { IPivotConfiguration, IgxPivotDateDimension, IgxPivotNumericAggregate, PivotAggregation, IgxExcelExporterOptions, IgxExcelExporterService } from 'igniteui-angular/grids/core'; |
| 3 | +import { IPivotConfiguration, IgxPivotDateDimension, IgxPivotNumericAggregate, PivotAggregation, IgxExcelExporterOptions, IgxExcelExporterService, IgxPdfExporterService, IgxPdfExporterOptions } from 'igniteui-angular/grids/core'; |
4 | 4 | import { IgxPivotGridComponent } from 'igniteui-angular/grids/pivot-grid'; |
5 | 5 | import { IgxButtonDirective } from 'igniteui-angular/directives'; |
6 | 6 | import { SALES_DATA } from "../../data/dataToAnalyze"; |
@@ -40,9 +40,10 @@ export class IgxTotalSaleAggregate { |
40 | 40 | }) |
41 | 41 | export class PivotExportComponent { |
42 | 42 | private excelExportService = inject(IgxExcelExporterService); |
| 43 | + private pdfExportService = inject(IgxPdfExporterService); |
43 | 44 |
|
44 | 45 | @ViewChild(IgxPivotGridComponent, { static: true }) public grid: IgxPivotGridComponent; |
45 | | - |
| 46 | + |
46 | 47 | public data = SALES_DATA; |
47 | 48 |
|
48 | 49 | public pivotConfig: IPivotConfiguration = { |
@@ -91,7 +92,7 @@ export class PivotExportComponent { |
91 | 92 | aggregator: IgxPivotNumericAggregate.sum, |
92 | 93 | label: 'Sum' |
93 | 94 | }], |
94 | | - enabled: true, |
| 95 | + enabled: false, |
95 | 96 | formatter: (value) => value ? '$' + parseFloat(value).toFixed(3) : undefined |
96 | 97 | }, |
97 | 98 | { |
@@ -124,4 +125,8 @@ export class PivotExportComponent { |
124 | 125 | public exportButtonHandler() { |
125 | 126 | this.excelExportService.export(this.grid, new IgxExcelExporterOptions('ExportedDataFile')); |
126 | 127 | } |
| 128 | + |
| 129 | + public exportPdfButtonHandler() { |
| 130 | + this.pdfExportService.export(this.grid, new IgxPdfExporterOptions('ExportedDataFile')); |
| 131 | + } |
127 | 132 | } |
0 commit comments