@@ -12,12 +12,13 @@ import { Component, OnInit } from '@angular/core';
1212 </tr>
1313 </thead>
1414 <tbody>
15- <tr *ngFor="let data of middleTable.data">
16- <td>{{ data.name }}</td>
17- <td>{{ data.borrow }}</td>
18- <td>{{ data.repayment }}</td>
19- </tr>
20- <tr></tr>
15+ @for (data of middleTable.data; track $index) {
16+ <tr>
17+ <td>{{ data.name }}</td>
18+ <td>{{ data.borrow }}</td>
19+ <td>{{ data.repayment }}</td>
20+ </tr>
21+ }
2122 </tbody>
2223 <tfoot nzSummary>
2324 <tr>
@@ -37,12 +38,42 @@ import { Component, OnInit } from '@angular/core';
3738 </tr>
3839 </tfoot>
3940 </nz-table>
41+
42+ <br />
43+
44+ <nz-table
45+ #fixedTable
46+ nzBordered
47+ [nzData]="fixedData"
48+ [nzShowPagination]="false"
49+ [nzScroll]="{ x: '1280px', y: '500px' }"
50+ >
51+ <thead>
52+ <tr>
53+ <th>Name</th>
54+ <th>Description</th>
55+ </tr>
56+ </thead>
57+ <tbody>
58+ @for (data of fixedTable.data; track data.key) {
59+ <tr>
60+ <td>{{ data.name }}</td>
61+ <td>{{ data.description }}</td>
62+ </tr>
63+ }
64+ </tbody>
65+ <tfoot nzSummary nzFixed>
66+ <tr>
67+ <td>Summary</td>
68+ <td>This is a summary content</td>
69+ </tr>
70+ </tfoot>
71+ </nz-table>
4072 ` ,
4173 styles : [
4274 `
43- tfoot th,
44- tfoot td {
45- background: #fafafa;
75+ :host ::ng-deep tfoot.ant-table-summary {
76+ background-color: #fafafa !important;
4677 }
4778 `
4879 ]
@@ -71,13 +102,22 @@ export class NzDemoTableSummaryComponent implements OnInit {
71102 }
72103 ] ;
73104
74- fixedData : Array < { name : string ; description : string } > = [ ] ;
105+ fixedData : Array < { key : number ; name : string ; description : string } > = [ ] ;
75106 totalBorrow = 0 ;
76107 totalRepayment = 0 ;
108+
77109 ngOnInit ( ) : void {
78110 this . data . forEach ( ( { borrow, repayment } ) => {
79111 this . totalBorrow += borrow ;
80112 this . totalRepayment += repayment ;
81113 } ) ;
114+
115+ for ( let i = 0 ; i < 20 ; i += 1 ) {
116+ this . fixedData . push ( {
117+ key : i ,
118+ name : [ 'Light' , 'Bamboo' , 'Little' ] [ i % 3 ] ,
119+ description : 'Everything that has a beginning, has an end.'
120+ } ) ;
121+ }
82122 }
83123}
0 commit comments