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)} >` )}