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

fix(grids): Set inline min-height to cell if a rowHeight is added by input #14637

Merged
merged 5 commits into from
Sep 17, 2024
Merged
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
6 changes: 6 additions & 0 deletions projects/igniteui-angular/src/lib/grids/cell.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,12 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
@HostBinding('class.igx-grid__td--row-pinned-first')
public displayPinnedChip = false;

@HostBinding('style.min-height.px')
protected get minHeight() {
if ((this.grid as any).isCustomSetRowHeight) {
return this.grid.renderedRowHeight;
}
}

@ViewChild('defaultCell', { read: TemplateRef, static: true })
protected defaultCellTemplate: TemplateRef<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3228,6 +3228,10 @@ export abstract class IgxGridBaseDirective implements GridType,
return MINIMUM_COLUMN_WIDTH;
}

protected get isCustomSetRowHeight(): boolean {
return !isNaN(this._rowHeight);
}

/**
* @hidden @internal
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,17 @@ describe('IgxGrid Component Tests #grid', () => {
expect(parseInt(window.getComputedStyle(gridBody.nativeElement).height, 10)).toBeGreaterThan(0);
expect(gridBody.nativeElement.innerText).toMatch(grid.emptyGridMessage);
}));

it('should apply correct rowHeight when set as input', () => {
const fixture = TestBed.createComponent(IgxGridTestComponent);
const grid = fixture.componentInstance.grid;
grid.rowHeight = 75;
fixture.detectChanges();

const cell = fixture.debugElement.query(By.css(TBODY_CLASS)).query(By.css('.igx-grid__td')).nativeElement;
const expectedCellHeight = 76; // rowHeight + 1px border
expect(cell.offsetHeight).toEqual(expectedCellHeight);
});
});

describe('IgxGrid - virtualization tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
hierarchicalGrid.verticalScrollContainer.getScroll().scrollTop = 2000;
fixture.detectChanges();
await wait(50);
fixture.detectChanges();

const hierarchicalGridRect = hierarchicalGrid.tbody.nativeElement.getBoundingClientRect();
const lastRowRect = hierarchicalGrid.dataRowList.last.nativeElement.getBoundingClientRect();
Expand Down
Loading