Skip to content

Commit ce26438

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix issue with container height.
1 parent e7829db commit ce26438

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
</igx-grid-header-group>
163163
</ng-container>
164164
</ng-container>
165-
<div>
165+
<div [style.max-height.px]='maxContainerHeight'>
166166
<div class="igx-grid-thead__group" *ngFor='let dimLevelColumns of columnDimensionsByLevel' [style.width.px]='grid.unpinnedWidth'>
167167
<ng-template igxGridFor #headerVirtualContainer let-column
168168
[igxGridForOf]="dimLevelColumns" [igxForScrollContainer]="grid.parentVirtDir"

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

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { PivotUtil } from './pivot-util';
4040
selector: 'igx-pivot-header-row',
4141
templateUrl: './pivot-header-row.component.html'
4242
})
43-
export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implements OnChanges{
43+
export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implements OnChanges {
4444
public aggregateList: IPivotAggregator[] = [];
4545

4646
public value: IPivotValue;
@@ -66,18 +66,34 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
6666
super(ref, cdr);
6767
}
6868

69-
/** The virtualized part of the header row containing the unpinned header groups. */
70-
@ViewChildren('headerVirtualContainer', { read: IgxGridForOfDirective})
71-
public headerContainers: QueryList<IgxGridForOfDirective<IgxGridHeaderGroupComponent>>;
69+
/** The virtualized part of the header row containing the unpinned header groups. */
70+
@ViewChildren('headerVirtualContainer', { read: IgxGridForOfDirective })
71+
public headerContainers: QueryList<IgxGridForOfDirective<IgxGridHeaderGroupComponent>>;
7272

73-
public get headerForOf() {
74-
return this.headerContainers.last;
75-
}
73+
public get headerForOf() {
74+
return this.headerContainers.last;
75+
}
7676

7777
@ViewChildren('notifyChip')
7878
public notificationChips: QueryList<IgxChipComponent>;
7979

80-
public columnDimensionsByLevel: any[];
80+
public columnDimensionsByLevel: any[] = [];
81+
public get totalDepth() {
82+
const columnDimensions = this.grid.columnDimensions;
83+
if (columnDimensions.length === 0) {
84+
return 1;
85+
}
86+
let totalDepth = columnDimensions.map(x => PivotUtil.getDimensionDepth(x)).reduce((acc, val) => acc + val) + 1;
87+
if (this.grid.hasMultipleValues) {
88+
totalDepth += 1;
89+
}
90+
return totalDepth;
91+
}
92+
93+
public get maxContainerHeight() {
94+
return this.totalDepth * this.grid.renderedRowHeight;
95+
}
96+
8197

8298
public populateColumnDimensionsByLevel() {
8399
const res = [];
@@ -87,11 +103,7 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
87103
return;
88104
}
89105
const cols = this.unpinnedColumnCollection;
90-
let totalDepth = columnDimensions.map(x => PivotUtil.getDimensionDepth(x)).reduce((acc, val) => acc + val) + 1;
91-
if (this.grid.hasMultipleValues) {
92-
totalDepth += 1;
93-
}
94-
for (let i = 0; i < totalDepth; i++) {
106+
for (let i = 0; i < this.totalDepth; i++) {
95107
const lvl = i;
96108
const colsForLevel = cols.filter(x => x.level === lvl);
97109
res[i] = colsForLevel;
@@ -100,17 +112,17 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
100112
}
101113

102114
public ngOnChanges(changes: SimpleChanges) {
103-
if (changes.unpinnedColumnCollection) {
115+
if (changes.unpinnedColumnCollection && this.unpinnedColumnCollection.length > 0) {
104116
this.populateColumnDimensionsByLevel();
105-
}
117+
}
106118
}
107119

108120
public onDimDragStart(event, area) {
109121
this.cdr.detectChanges();
110122
for (let chip of this.notificationChips) {
111123
if (area.chipsList.toArray().indexOf(chip) === -1 &&
112-
chip.nativeElement.parentElement.children.length > 0 &&
113-
chip.nativeElement.parentElement.children.item(0).id !== 'empty' ) {
124+
chip.nativeElement.parentElement.children.length > 0 &&
125+
chip.nativeElement.parentElement.children.item(0).id !== 'empty') {
114126
chip.nativeElement.hidden = false;
115127
chip.nativeElement.scrollIntoView();
116128
}
@@ -124,7 +136,7 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
124136
}
125137

126138
public getAreaHeight(area: IgxChipsAreaComponent) {
127-
const chips = area.chipsList;
139+
const chips = area.chipsList;
128140
return chips && chips.length > 0 ? chips.first.nativeElement.clientHeight : 0;
129141
}
130142

0 commit comments

Comments
 (0)