@@ -44,65 +44,70 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
4444 </igx-pivot-grid>`
4545} )
4646export class IgxPivotGridTestBaseComponent {
47+ @ViewChild ( 'grid' , { read : IgxPivotGridComponent , static : true } ) public pivotGrid : IgxPivotGridComponent ;
4748 public data ;
4849
49- public callback = ( rowData : any , columnKey : any ) => rowData [ columnKey ] >= 5 ;
50- public callback1 = ( rowData : any , columnKey : any ) => rowData [ columnKey ] < 5 ;
5150
52- public cellClasses = {
53- test : this . callback ,
54- test2 : this . callback1
55- } ;
51+ public cellClasses ;
5652
57- @ViewChild ( 'grid' , { read : IgxPivotGridComponent , static : true } ) public pivotGrid : IgxPivotGridComponent ;
5853
59- public pivotConfigHierarchy : IPivotConfiguration = {
60- columns : [ {
61- member : 'Country' ,
62- enabled : true ,
63- childLevels : [ ]
64- } ,
65- ] ,
66- rows : [ {
67- member : ( ) => 'All' ,
68- enabled : true ,
69- childLevels : [
70- {
71- fieldName : 'ProductCategory' ,
72- member : ( data ) => data . ProductCategory ,
73- enabled : true ,
74- childLevels : [ ]
75- }
76- ]
77- } ] ,
78- values : [
79- {
80- member : 'UnitsSold' ,
81- aggregate : IgxNumberSummaryOperand . sum ,
82- enabled : true ,
83- // dataType: 'currency',
84- formatter : ( value ) => value ? value + '$' : undefined ,
85- styles : this . cellClasses
86- } ,
87- {
88- member : 'UnitPrice' ,
89- aggregate : IgxNumberSummaryOperand . sum ,
90- enabled : true ,
91- dataType : 'currency'
92- }
93- ] ,
94- filters : null
95- } ;
54+ public pivotConfigHierarchy : IPivotConfiguration ;
9655
9756 constructor ( ) {
98- this . data = [ { ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley' , Country : 'Bulgaria' , Date : '01/01/2021' , UnitsSold : 282 } ,
99- { ProductCategory : 'Clothing' , UnitPrice : 49.57 , SellerName : 'Elisa' , Country : 'USA' , Date : '01/05/2019' , UnitsSold : 296 } ,
100- { ProductCategory : 'Bikes' , UnitPrice : 3.56 , SellerName : 'Lydia' , Country : 'Uruguay' , Date : '01/06/2020' , UnitsSold : 68 } ,
101- { ProductCategory : 'Accessories' , UnitPrice : 85.58 , SellerName : 'David' , Country : 'USA' , Date : '04/07/2021' , UnitsSold : 293 } ,
102- { ProductCategory : 'Components' , UnitPrice : 18.13 , SellerName : 'John' , Country : 'USA' , Date : '12/08/2021' , UnitsSold : 240 } ,
103- { ProductCategory : 'Clothing' , UnitPrice : 68.33 , SellerName : 'Larry' , Country : 'Uruguay' , Date : '05/12/2020' , UnitsSold : 456 } ,
104- { ProductCategory : 'Clothing' , UnitPrice : 16.05 , SellerName : 'Walter' , Country : 'Bulgaria' , Date : '02/19/2020' , UnitsSold : 492 } ] ;
57+ this . data = [
58+ { ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley' , Country : 'Bulgaria' , Date : '01/01/2021' , UnitsSold : 282 } ,
59+ { ProductCategory : 'Clothing' , UnitPrice : 49.57 , SellerName : 'Elisa' , Country : 'USA' , Date : '01/05/2019' , UnitsSold : 296 } ,
60+ { ProductCategory : 'Bikes' , UnitPrice : 3.56 , SellerName : 'Lydia' , Country : 'Uruguay' , Date : '01/06/2020' , UnitsSold : 68 } ,
61+ { ProductCategory : 'Accessories' , UnitPrice : 85.58 , SellerName : 'David' , Country : 'USA' , Date : '04/07/2021' , UnitsSold : 293 } ,
62+ { ProductCategory : 'Components' , UnitPrice : 18.13 , SellerName : 'John' , Country : 'USA' , Date : '12/08/2021' , UnitsSold : 240 } ,
63+ { ProductCategory : 'Clothing' , UnitPrice : 68.33 , SellerName : 'Larry' , Country : 'Uruguay' , Date : '05/12/2020' , UnitsSold : 456 } ,
64+ { ProductCategory : 'Clothing' , UnitPrice : 16.05 , SellerName : 'Walter' , Country : 'Bulgaria' , Date : '02/19/2020' , UnitsSold : 492 } ] ;
10565
66+ this . cellClasses = {
67+ test : this . callback ,
68+ test2 : this . callback1
69+ } ;
10670
71+ this . pivotConfigHierarchy = {
72+ columns : [ {
73+ member : 'Country' ,
74+ enabled : true ,
75+ childLevels : [ ]
76+ } ,
77+ ] ,
78+ rows : [ {
79+ member : ( ) => 'All' ,
80+ enabled : true ,
81+ childLevels : [
82+ {
83+ fieldName : 'ProductCategory' ,
84+ member : ( data ) => data . ProductCategory ,
85+ enabled : true ,
86+ childLevels : [ ]
87+ }
88+ ]
89+ } ] ,
90+ values : [
91+ {
92+ member : 'UnitsSold' ,
93+ aggregate : IgxNumberSummaryOperand . sum ,
94+ enabled : true ,
95+ // dataType: 'currency',
96+ formatter : ( value ) => value ? value + '$' : undefined ,
97+ styles : this . cellClasses
98+ } ,
99+ {
100+ member : 'UnitPrice' ,
101+ aggregate : IgxNumberSummaryOperand . sum ,
102+ enabled : true ,
103+ dataType : 'currency'
104+ }
105+ ] ,
106+ filters : null
107+ } ;
107108 }
109+
110+ public callback = ( rowData : any , columnKey : any ) => rowData [ columnKey ] >= 5 ;
111+ public callback1 = ( rowData : any , columnKey : any ) => rowData [ columnKey ] < 5 ;
112+
108113}
0 commit comments