Skip to content

Commit a1f1ea3

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Cache resuly and update only on change.
1 parent 1036177 commit a1f1ea3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-header-row.component.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import {
44
Component,
55
ElementRef,
66
Inject,
7+
OnChanges,
78
QueryList,
89
Renderer2,
10+
SimpleChanges,
911
ViewChildren
1012
} from '@angular/core';
1113
import { first } from 'rxjs/operators';
@@ -38,7 +40,7 @@ import { PivotUtil } from './pivot-util';
3840
selector: 'igx-pivot-header-row',
3941
templateUrl: './pivot-header-row.component.html'
4042
})
41-
export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent {
43+
export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implements OnChanges{
4244
public aggregateList: IPivotAggregator[] = [];
4345

4446
public value: IPivotValue;
@@ -75,7 +77,9 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent {
7577
@ViewChildren('notifyChip')
7678
public notificationChips: QueryList<IgxChipComponent>;
7779

78-
public get columnDimensionsByLevel() {
80+
public columnDimensionsByLevel: any[];
81+
82+
public populateColumnDimensionsByLevel() {
7983
const res = [];
8084
const columnDimensions = this.grid.columnDimensions;
8185
const cols = this.unpinnedColumnCollection;
@@ -88,7 +92,13 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent {
8892
const colsForLevel = cols.filter(x => x.level === lvl);
8993
res[i] = colsForLevel;
9094
}
91-
return res;
95+
this.columnDimensionsByLevel = res;
96+
}
97+
98+
public ngOnChanges(changes: SimpleChanges) {
99+
if (changes.unpinnedColumnCollection) {
100+
this.populateColumnDimensionsByLevel();
101+
}
92102
}
93103

94104
public onDimDragStart(event, area) {

0 commit comments

Comments
 (0)