From 66ed45a302d2c40988f024942873e469ba9a5fd2 Mon Sep 17 00:00:00 2001 From: Radoslav Karaivanov Date: Fri, 23 Jan 2026 15:54:48 +0200 Subject: [PATCH] fix(cell): improve local cell detection logic Explicitly pass the row index and the cell template so that the local cell detection works correctly --- src/components/cell.ts | 11 +++++++++-- src/components/row.ts | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/cell.ts b/src/components/cell.ts index 61eafa7..b9219ac 100644 --- a/src/components/cell.ts +++ b/src/components/cell.ts @@ -43,8 +43,15 @@ export default class IgcGridLiteCell extends LitElement { /** * The parent row component holding this cell. */ + @property({ attribute: false }) public row!: IgcGridLiteRow; + @property({ attribute: false }) + public rowIndex = -1; + + @property({ attribute: false }) + public cellTemplate?: (context: IgcCellContext) => unknown; + protected get context(): IgcCellContext { return { parent: this, @@ -56,8 +63,8 @@ export default class IgcGridLiteCell extends LitElement { protected override render() { return html`${cache( - this.column.cellTemplate - ? this.column.cellTemplate(this.context as any) + this.cellTemplate + ? this.cellTemplate(this.context as any) : html`${this.value}` )}`; } diff --git a/src/components/row.ts b/src/components/row.ts index daa2dc4..73e10cf 100644 --- a/src/components/row.ts +++ b/src/components/row.ts @@ -51,7 +51,9 @@ export default class IgcGridLiteRow extends LitElement { part="cell" .active=${key === column.field && index === this.index} .column=${column} + .cellTemplate=${column.cellTemplate} .row=${this as IgcGridLiteRow} + .rowIndex=${this.index} .value=${resolveFieldValue(data, column.field)} >` )}