@@ -100,11 +100,11 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
100100 * @hidden
101101 */
102102 public ngAfterContentInit ( ) {
103- // ignore any user defined columns and auto-generate based on pivot config.
104- this . columnList . reset ( [ ] ) ;
105- Promise . resolve ( ) . then ( ( ) => {
106- this . setupColumns ( ) ;
107- } ) ;
103+ // ignore any user defined columns and auto-generate based on pivot config.
104+ this . columnList . reset ( [ ] ) ;
105+ Promise . resolve ( ) . then ( ( ) => {
106+ this . setupColumns ( ) ;
107+ } ) ;
108108 }
109109
110110 /** @hidden */
@@ -205,18 +205,18 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
205205 return MINIMUM_COLUMN_WIDTH * rowDimCount ;
206206 }
207207
208- public toggleColumn ( col : IgxColumnComponent ) {
209- const state = this . columnGroupStates . get ( col . field ) ;
210- const newState = ! state ;
211- this . columnGroupStates . set ( col . field , newState ) ;
212- this . toggleGroup ( col , newState ) ;
213- this . reflow ( ) ;
214- }
208+ public toggleColumn ( col : IgxColumnComponent ) {
209+ const state = this . columnGroupStates . get ( col . field ) ;
210+ const newState = ! state ;
211+ this . columnGroupStates . set ( col . field , newState ) ;
212+ this . toggleGroup ( col , newState ) ;
213+ this . reflow ( ) ;
214+ }
215215
216- protected toggleGroup ( col : IgxColumnComponent , newState : boolean ) {
216+ protected toggleGroup ( col : IgxColumnComponent , newState : boolean ) {
217217 if ( this . hasMultipleValues ) {
218- const fieldColumns = col . children . filter ( x => ! x . columnGroup ) ;
219- const groupColumns = col . children . filter ( x => x . columnGroup ) ;
218+ const fieldColumns = col . children . filter ( x => ! x . columnGroup ) ;
219+ const groupColumns = col . children . filter ( x => x . columnGroup ) ;
220220 groupColumns . forEach ( groupColumn => {
221221 groupColumn . hidden = newState ;
222222 this . resolveToggle ( groupColumn ) ;
@@ -226,23 +226,23 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
226226 } ) ;
227227 } else {
228228 const parentCols = col . parent ? col . parent . children : this . columns . filter ( x => x . level === 0 ) ;
229- const fieldColumn = parentCols . filter ( x => x . header === col . header && ! x . columnGroup ) [ 0 ] ;
230- const groupColumn = parentCols . filter ( x => x . header === col . header && x . columnGroup ) [ 0 ] ;
229+ const fieldColumn = parentCols . filter ( x => x . header === col . header && ! x . columnGroup ) [ 0 ] ;
230+ const groupColumn = parentCols . filter ( x => x . header === col . header && x . columnGroup ) [ 0 ] ;
231231 groupColumn . hidden = newState ;
232232 this . resolveToggle ( groupColumn ) ;
233233 fieldColumn . hidden = ! newState ;
234234 if ( newState ) {
235- fieldColumn . headerTemplate = this . headerTemplate ;
235+ fieldColumn . headerTemplate = this . headerTemplate ;
236236 } else {
237- fieldColumn . headerTemplate = undefined ;
237+ fieldColumn . headerTemplate = undefined ;
238238 }
239239 }
240- }
240+ }
241241
242- protected resolveToggle ( groupColumn : IgxColumnComponent ) {
243- const hasChildGroup = groupColumn . children . filter ( x => x . columnGroup ) . length > 0 ;
244- if ( ! groupColumn . hidden && hasChildGroup ) {
245- const fieldChildren = groupColumn . children . filter ( x => ! x . columnGroup ) ;
242+ protected resolveToggle ( groupColumn : IgxColumnComponent ) {
243+ const hasChildGroup = groupColumn . children . filter ( x => x . columnGroup ) . length > 0 ;
244+ if ( ! groupColumn . hidden && hasChildGroup ) {
245+ const fieldChildren = groupColumn . children . filter ( x => ! x . columnGroup ) ;
246246 const groupChildren = groupColumn . children . filter ( x => x . columnGroup ) ;
247247 groupChildren . forEach ( group => {
248248 this . resolveToggle ( group ) ;
@@ -273,8 +273,8 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
273273 data ,
274274 this . pivotConfiguration . columns ,
275275 PivotDimensionType . Column ,
276- { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
277- ) ;
276+ { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
277+ ) ;
278278 const columns = this . generateColumnHierarchy ( fieldsMap , data ) ;
279279 this . _autoGeneratedCols = columns ;
280280
@@ -291,15 +291,15 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
291291 fields . forEach ( ( value , key ) => {
292292 if ( value . children == null || value . children . length === 0 || value . children . size === 0 ) {
293293 const ref = this . hasMultipleValues ?
294- factoryColumnGroup . create ( this . viewRef . injector ) :
295- factoryColumn . create ( this . viewRef . injector ) ;
294+ factoryColumnGroup . create ( this . viewRef . injector ) :
295+ factoryColumn . create ( this . viewRef . injector ) ;
296296 ref . instance . header = parent != null ? key . split ( parent . header + '-' ) [ 1 ] : key ;
297297 ref . instance . field = key ;
298298 ref . instance . parent = parent ;
299299 ref . changeDetectorRef . detectChanges ( ) ;
300300 columns . push ( ref . instance ) ;
301301 if ( this . hasMultipleValues ) {
302- const measureChildren = this . getMeasureChildren ( factoryColumn , data , ref . instance , false ) ;
302+ const measureChildren = this . getMeasureChildren ( factoryColumn , data , ref . instance , false ) ;
303303 ref . instance . children . reset ( measureChildren ) ;
304304 columns = columns . concat ( measureChildren ) ;
305305 }
@@ -312,7 +312,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
312312 if ( value . expandable ) {
313313 ref . instance . headerTemplate = this . headerTemplate ;
314314 }
315- if ( ! this . hasMultipleValues ) {
315+ if ( ! this . hasMultipleValues ) {
316316 const refSibling = factoryColumn . create ( this . viewRef . injector ) ;
317317 refSibling . instance . header = parent != null ? key . split ( parent . header + '-' ) [ 1 ] : key ;
318318 refSibling . instance . field = key ;
@@ -326,7 +326,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
326326 ref . changeDetectorRef . detectChanges ( ) ;
327327 columns . push ( ref . instance ) ;
328328 if ( this . hasMultipleValues ) {
329- const measureChildren = this . getMeasureChildren ( factoryColumn , data , ref . instance , true ) ;
329+ const measureChildren = this . getMeasureChildren ( factoryColumn , data , ref . instance , true ) ;
330330 const nestedChildren = filteredChildren . concat ( measureChildren ) ;
331331 const allChildren = children . concat ( measureChildren ) ;
332332 ref . instance . children . reset ( nestedChildren ) ;
@@ -345,7 +345,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
345345 const cols = [ ] ;
346346 this . pivotConfiguration . values . forEach ( val => {
347347 const ref = colFactory . create ( this . viewRef . injector ) ;
348- ref . instance . header = val . member ;
348+ ref . instance . header = val . displayName || val . member ;
349349 ref . instance . field = parent . field + '-' + val . member ;
350350 ref . instance . parent = parent ;
351351 ref . instance . hidden = hidden ;
0 commit comments