/
table-multiple-header-footer-example.html
45 lines (38 loc) · 1.79 KB
/
table-multiple-header-footer-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<table mat-table [dataSource]="transactions" class="mat-elevation-z8">
<!-- Item Column -->
<ng-container matColumnDef="item">
<th mat-header-cell *matHeaderCellDef> Item </th>
<td mat-cell *matCellDef="let transaction"> {{transaction.item}} </td>
<td mat-footer-cell *matFooterCellDef> Total </td>
</ng-container>
<!-- Cost Column -->
<ng-container matColumnDef="cost">
<th mat-header-cell *matHeaderCellDef> Cost </th>
<td mat-cell *matCellDef="let transaction"> {{transaction.cost | currency}} </td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost() | currency}} </td>
</ng-container>
<!-- Item Description Column -->
<ng-container matColumnDef="item-description">
<th mat-header-cell *matHeaderCellDef> Name of the item purchased </th>
</ng-container>
<!-- Cost Description Column -->
<ng-container matColumnDef="cost-description">
<th mat-header-cell *matHeaderCellDef> Cost of the item in USD </th>
</ng-container>
<!-- Disclaimer column -->
<ng-container matColumnDef="disclaimer">
<td mat-footer-cell *matFooterCellDef colspan="2">
Please note that the cost of items displayed are completely and totally made up.
</td>
</ng-container>
<!-- The table will render two header rows, one data row per data object, and two footer rows. -->
<tr mat-header-row *matHeaderRowDef="displayedColumns"
class="example-first-header-row">
</tr>
<tr mat-header-row *matHeaderRowDef="['item-description', 'cost-description']"
class="example-second-header-row">
</tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns" class="example-first-footer-row"></tr>
<tr mat-footer-row *matFooterRowDef="['disclaimer']" class="example-second-footer-row"></tr>
</table>