Skip to content

Commit 0f22247

Browse files
MKirovaMayaKirova
authored andcommitted
fix(igxGrid): Fix size calculation in case parent is shadow DOM root.
1 parent 8f60e5a commit 0f22247

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7021,18 +7021,20 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
70217021
}
70227022

70237023
protected checkContainerSizeChange() {
7024-
const origHeight = this.nativeElement.parentElement.offsetHeight;
7024+
const parentElement = this.nativeElement.parentElement || (this.nativeElement.getRootNode() as any).host;
7025+
const origHeight = parentElement.offsetHeight;
70257026
this.nativeElement.style.display = 'none';
7026-
const height = this.nativeElement.parentElement.offsetHeight;
7027+
const height = parentElement.offsetHeight;
70277028
this.nativeElement.style.display = '';
70287029
return origHeight !== height;
70297030
}
70307031

70317032
protected _shouldAutoSize(renderedHeight) {
70327033
this.tbody.nativeElement.style.display = 'none';
7033-
let res = !this.nativeElement.parentElement ||
7034-
this.nativeElement.parentElement.clientHeight === 0 ||
7035-
this.nativeElement.parentElement.clientHeight === renderedHeight;
7034+
const parentElement = this.nativeElement.parentElement || (this.nativeElement.getRootNode() as any).host;
7035+
let res = !parentElement ||
7036+
parentElement.clientHeight === 0 ||
7037+
parentElement.clientHeight === renderedHeight;
70367038
if ((!this.platform.isChromium && !this.platform.isFirefox) || this._autoSize) {
70377039
// If grid causes the parent container to extend (for example when container is flex)
70387040
// we should always auto-size since the actual size of the container will continuously change as the grid renders elements.

0 commit comments

Comments
 (0)