Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
booleanAttribute,
ComponentRef,
createComponent,
Directive,
EventEmitter,
Expand Down Expand Up @@ -132,6 +133,8 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
/* blazorSuppress */
public abstract expandChildren: boolean;

protected _rowIslandColumnRefs: ComponentRef<IgxColumnComponent>[] = [];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot IgxColumnGroupComponent extends IgxColumnComponent, so it should be fine, shouldn't it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's fine. IgxColumnGroupComponent extends IgxColumnComponent, so ComponentRef<IgxColumnGroupComponent> is assignable to ComponentRef<IgxColumnComponent> and the array type covers both cases. We only ever call ref.destroy() on the stored refs, so the base type is sufficient here — no change needed.


/**
* @hidden
*/
Expand All @@ -141,6 +144,7 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
topLevelCols.forEach((col) => {
col.grid = this;
const ref = this._createColumn(col);
this._rowIslandColumnRefs.push(ref);
ref.changeDetectorRef.detectChanges();
columns.push(ref.instance);
});
Expand Down Expand Up @@ -189,7 +193,9 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
if (col.children.length > 0) {
const newChildren = [];
col.children.forEach(child => {
const newCol = this._createColumn(child).instance;
const childRef = this._createColumn(child);
this._rowIslandColumnRefs.push(childRef);
const newCol = childRef.instance;
newCol.parent = ref.instance;
newChildren.push(newCol);
});
Expand All @@ -214,6 +220,16 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
return ref;
}

public override ngOnDestroy() {
this.destroyRowIslandColumnRefs();
super.ngOnDestroy();
}
Comment on lines +223 to +226

protected destroyRowIslandColumnRefs() {
this._rowIslandColumnRefs.forEach(ref => ref.destroy());
this._rowIslandColumnRefs = [];
}

protected getGridsForIsland(rowIslandID: string) {
return this.gridAPI.getChildGridsForRowIsland(rowIslandID);
}
Expand Down
Loading