Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions src/components/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ export default class IgcGridLiteCell<T extends object> extends LitElement {
/**
* The parent row component holding this cell.
*/
@property({ attribute: false })
public row!: IgcGridLiteRow<T>;

@property({ attribute: false })
public rowIndex = -1;

@property({ attribute: false })
public cellTemplate?: (context: IgcCellContext<T>) => unknown;

protected get context(): IgcCellContext<T> {
return {
parent: this,
Expand All @@ -56,8 +63,8 @@ export default class IgcGridLiteCell<T extends object> 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`<span part="text">${this.value}</span>`
)}`;
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default class IgcGridLiteRow<T extends object> extends LitElement {
part="cell"
.active=${key === column.field && index === this.index}
.column=${column}
.cellTemplate=${column.cellTemplate}
.row=${this as IgcGridLiteRow<T>}
.rowIndex=${this.index}
.value=${resolveFieldValue(data, column.field)}
></igc-grid-lite-cell>`
)}
Expand Down