@@ -14,7 +14,11 @@ import {
1414 IgxPivotDataSelectorComponent ,
1515 IgxPivotRowDimensionHeaderTemplateDirective ,
1616 IPivotUISettings ,
17- PivotRowLayoutType
17+ PivotRowLayoutType ,
18+ IgxExcelExporterService ,
19+ IgxExcelExporterOptions ,
20+ IgxSwitchComponent ,
21+ IChangeCheckboxEventArgs
1822} from 'igniteui-angular' ;
1923
2024export class IgxTotalSaleAggregate {
@@ -50,7 +54,7 @@ export class IgxTotalSaleAggregate {
5054 styleUrls : [ 'pivot-grid-state.sample.scss' ] ,
5155 templateUrl : 'pivot-grid-state.sample.html' ,
5256 standalone : true ,
53- imports : [ FormsModule , IgxButtonDirective ,
57+ imports : [ FormsModule , IgxButtonDirective , IgxSwitchComponent ,
5458 IgxPivotGridComponent , IgxGridStateDirective , IgxPivotDataSelectorComponent , IgxPivotRowDimensionHeaderTemplateDirective ]
5559} )
5660export class PivotGridStateSampleComponent {
@@ -70,12 +74,6 @@ export class PivotGridStateSampleComponent {
7074 ) ,
7175 ] ,
7276 rows : [
73- // {
74- // memberName: 'AllSellers',
75- // displayName: 'All Sellers',
76- // memberFunction: () => 'All',
77- // enabled: true
78- // },
7977 {
8078 memberName : 'Country' ,
8179 displayName : 'Country' ,
@@ -171,6 +169,8 @@ export class PivotGridStateSampleComponent {
171169 @ViewChild ( IgxGridStateDirective , { static : true } )
172170 public state ! : IgxGridStateDirective ;
173171
172+ constructor ( private exportService : IgxExcelExporterService ) { }
173+
174174 public saveState ( ) {
175175 const state = this . state . getState ( ) as string ;
176176 window . sessionStorage . setItem ( 'grid-state' , state ) ;
@@ -194,5 +194,17 @@ export class PivotGridStateSampleComponent {
194194 }
195195 }
196196
197+ public export ( ) {
198+ this . exportService . export ( this . grid1 , new IgxExcelExporterOptions ( 'ExportedFile' ) ) ;
199+ }
197200
201+ public onShowHeadersToggle ( event : IChangeCheckboxEventArgs ) {
202+ this . pivotUI . showRowHeaders = event . checked ;
203+ this . grid1 . pivotUI = this . pivotUI ;
204+ }
205+
206+ public onLayoutToggle ( event : IChangeCheckboxEventArgs ) {
207+ this . pivotUI . rowLayout = event . checked ? PivotRowLayoutType . Horizontal : PivotRowLayoutType . Vertical ;
208+ this . grid1 . pivotUI = this . pivotUI ;
209+ }
198210}
0 commit comments