Skip to content

Commit

Permalink
feat: data-table context row and column
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismclarke committed Feb 15, 2024
1 parent 015d54f commit 80fa1a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/shared/src/features/data-table/data-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@

<!-- Main Table -->
<table mat-table matSort [dataSource]="dataSource" [matSortDisabled]="!tableOptions.sort">
@for(column of tableOptions.displayColumns; track column){
@for(column of tableOptions.displayColumns; track column; let index=$index){
<ng-container [matColumnDef]="column">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ column | formatValue: tableOptions.formatHeader }}</th>

<td mat-cell *matCellDef="let el">
<td mat-cell *matCellDef="let row">
@if(valueTemplates[column]){
<!-- custom value templates -->
<ng-container
[ngTemplateOutlet]="valueTemplates[column]"
[ngTemplateOutletContext]="{ $implicit: el[column] }"
[ngTemplateOutletContext]="$any({ $implicit: row[column], row: row, column: column })"
></ng-container>
} @else {
<!-- Default value template -->
{{ el[column] }}
{{ row[column] }}
}
</td>
</ng-container>
Expand Down

0 comments on commit 80fa1a0

Please sign in to comment.