From d5ab50a3e3a68a1e8847da9d36614cf06edfd9d7 Mon Sep 17 00:00:00 2001 From: MKirova Date: Mon, 16 Jun 2025 11:42:00 +0300 Subject: [PATCH 1/3] fix(action-strip): Assign parent to not destroy on DOM move. --- .../igniteui-angular-elements/src/app/custom-strategy.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/igniteui-angular-elements/src/app/custom-strategy.ts b/projects/igniteui-angular-elements/src/app/custom-strategy.ts index 1907cba1fe7..48b84a4d538 100644 --- a/projects/igniteui-angular-elements/src/app/custom-strategy.ts +++ b/projects/igniteui-angular-elements/src/app/custom-strategy.ts @@ -114,6 +114,13 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy { // ngElementStrategy getter is protected and also has initialization logic, though that should be safe at this point if (parent?.ngElementStrategy) { this.angularParent = parent.ngElementStrategy.angularParent; + + // action strip is reused in row island child grid + // assign parent so it's not destroyed on detach/attach. + if (element.tagName.toLocaleLowerCase() === 'igc-action-strip') { + this.angularParent = (parent.ngElementStrategy as any).componentRef; + } + this.parentElement = new WeakRef(parent); let parentComponentRef = await parent?.ngElementStrategy[ComponentRefKey]; parentInjector = parentComponentRef?.injector; From 60f3c029addb1335274007ff201f9522873f7e85 Mon Sep 17 00:00:00 2001 From: MKirova Date: Mon, 16 Jun 2025 12:05:54 +0300 Subject: [PATCH 2/3] chore(*): Move strip handling after parentComponentRef is populated. --- .../src/app/custom-strategy.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/igniteui-angular-elements/src/app/custom-strategy.ts b/projects/igniteui-angular-elements/src/app/custom-strategy.ts index 48b84a4d538..25aea19dd78 100644 --- a/projects/igniteui-angular-elements/src/app/custom-strategy.ts +++ b/projects/igniteui-angular-elements/src/app/custom-strategy.ts @@ -115,12 +115,6 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy { if (parent?.ngElementStrategy) { this.angularParent = parent.ngElementStrategy.angularParent; - // action strip is reused in row island child grid - // assign parent so it's not destroyed on detach/attach. - if (element.tagName.toLocaleLowerCase() === 'igc-action-strip') { - this.angularParent = (parent.ngElementStrategy as any).componentRef; - } - this.parentElement = new WeakRef(parent); let parentComponentRef = await parent?.ngElementStrategy[ComponentRefKey]; parentInjector = parentComponentRef?.injector; @@ -133,6 +127,12 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy { parentComponentRef = await parent?.ngElementStrategy[ComponentRefKey]; parentAnchor = parentComponentRef?.instance.anchor; } + + // action strip is reused for all rows + // assign parent so it's not destroyed on detach/attach. + if (element.tagName.toLocaleLowerCase() === 'igc-action-strip' || configParent.selector === 'igc-action-strip') { + this.angularParent = parentComponentRef; + } } else if ((parent as any)?.__componentRef) { this.angularParent = (parent as any).__componentRef; parentInjector = this.angularParent.injector; From 434a502659de902546ebc5fada76be0e205bfdb7 Mon Sep 17 00:00:00 2001 From: MKirova Date: Fri, 20 Jun 2025 15:02:24 +0300 Subject: [PATCH 3/3] fix(action-strip): Fix timing issues. --- .../igniteui-angular-elements/src/app/custom-strategy.ts | 6 ------ .../src/lib/action-strip/action-strip.component.ts | 3 +++ .../grid-actions/grid-editing-actions.component.ts | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/projects/igniteui-angular-elements/src/app/custom-strategy.ts b/projects/igniteui-angular-elements/src/app/custom-strategy.ts index 25aea19dd78..bfef980e8a9 100644 --- a/projects/igniteui-angular-elements/src/app/custom-strategy.ts +++ b/projects/igniteui-angular-elements/src/app/custom-strategy.ts @@ -114,7 +114,6 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy { // ngElementStrategy getter is protected and also has initialization logic, though that should be safe at this point if (parent?.ngElementStrategy) { this.angularParent = parent.ngElementStrategy.angularParent; - this.parentElement = new WeakRef(parent); let parentComponentRef = await parent?.ngElementStrategy[ComponentRefKey]; parentInjector = parentComponentRef?.injector; @@ -128,11 +127,6 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy { parentAnchor = parentComponentRef?.instance.anchor; } - // action strip is reused for all rows - // assign parent so it's not destroyed on detach/attach. - if (element.tagName.toLocaleLowerCase() === 'igc-action-strip' || configParent.selector === 'igc-action-strip') { - this.angularParent = parentComponentRef; - } } else if ((parent as any)?.__componentRef) { this.angularParent = (parent as any).__componentRef; parentInjector = this.angularParent.injector; diff --git a/projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts b/projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts index 56bfdf2c6f4..5fbff8c4973 100644 --- a/projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts +++ b/projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts @@ -279,6 +279,9 @@ export class IgxActionStripComponent implements IgxActionStripToken, AfterConten * ``` */ public show(context?: any): void { + if(!this._originalParent) { + this._originalParent = this._viewContainer.element.nativeElement?.parentElement; + } this.hidden = false; if (!context) { return; diff --git a/projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts b/projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts index e48ec8745f2..0f35205cb54 100644 --- a/projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts +++ b/projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts @@ -147,7 +147,7 @@ export class IgxGridEditingActionsComponent extends IgxGridActionsBaseDirective const context = this.strip.context; const grid = context.grid; grid.deleteRow(context.key); - + this.grid.cdr.detectChanges(); this.strip.hide(); }