Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed header height issue for grouped headers #14788

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions projects/igniteui-angular/src/lib/grids/grid-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2259,9 +2259,6 @@ export abstract class IgxGridBaseDirective implements GridType,
this._allowFiltering = value;
this.filteringService.registerSVGIcons();

if (!this._init) {
this.calcGridHeadRow();
}

this.filteringService.isFilterRowVisible = false;
this.filteringService.filteredColumn = null;
Expand Down Expand Up @@ -6813,25 +6810,11 @@ export abstract class IgxGridBaseDirective implements GridType,
}
}

/**
* @hidden
* @internal
*/
protected calcGridHeadRow() {
if (this.maxLevelHeaderDepth) {
this._baseFontSize = parseFloat(getComputedStyle(this.document.documentElement).getPropertyValue('font-size'));
const hasFilterRow = this._allowFiltering && this._filterMode === FilterMode.quickFilter;
const minSize = (this.maxLevelHeaderDepth + 1 + (hasFilterRow ? 1 : 0)) * this.defaultRowHeight / this._baseFontSize;
this.theadRow.nativeElement.style.minHeight = `${minSize}rem`;
}
}

/**
* @hidden
* Sets TBODY height i.e. this.calcHeight
*/
protected calculateGridHeight() {
this.calcGridHeadRow();

this.calcHeight = this._calculateGridBodyHeight();
if (this.pinnedRowHeight && this.calcHeight) {
Expand Down Expand Up @@ -7759,7 +7742,7 @@ export abstract class IgxGridBaseDirective implements GridType,
} else {
this._shouldRecalcRowHeight = true;
}
}
}
}

// TODO: About to Move to CRUD
Expand Down
13 changes: 13 additions & 0 deletions projects/igniteui-angular/src/lib/grids/grid/column-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ describe('IgxGrid - multi-column headers #grid', () => {
expect(grid.getColumnByName('ContactName').level).toEqual(expectedLevel);
});

it('should initialize a grid with correct header height', () => {
fixture = TestBed.createComponent(ColumnGroupTestComponent);
fixture.detectChanges();
grid = fixture.componentInstance.grid;

const expectedGridHeaderHeight = 151;
const headerHeight = grid.nativeElement
.querySelector("igx-grid-header-row")
.getBoundingClientRect().height;

expect(Math.round(headerHeight)).toEqual(expectedGridHeaderHeight);
});

it('Should render column group headers correctly.', fakeAsync(() => {
fixture = TestBed.createComponent(BlueWhaleGridComponent);
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,6 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
return this.selected;
}

@HostBinding('style.height.rem')
public get height() {
if (!this.grid.hasColumnGroups || this.grid.type === 'pivot') {
return null;
}

return (this.grid.maxLevelHeaderDepth + 1 - this.column.level) * this.grid.defaultRowHeight / this.grid._baseFontSize;
}

/**
* @hidden
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2080,13 +2080,6 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
}
}

/**
* @hidden
* @internal
*/
protected override calcGridHeadRow() {
}

protected override buildDataView(data: any[]) {
this._dataView = data;
}
Expand Down
Loading