【发布时间】:2019-08-30 00:50:48
【问题描述】:
我正在尝试使用 Angular 在表格页脚中显示列值的总数。
<mat-header-row class="sticky-header" *matHeaderRowDef="['player', 'team', 'goals']"></mat-header-row>
<mat-row *matRowDef="let row; columns: ['player', 'team', 'goals']"></mat-row>
<mat-row class="sticky-footer" *matRowDef="let row: columns: ['total']; when:isLastRow"></mat-row>
...
export class AppComponent {
dataSource: PlayerDataSource;
isLastRow = (data, index) => index === this.players.length;
players = STATS.slice();
constructor() {
this.dataSource = new PlayerDataSource();
this.dataSource.use(this.players.slice());
}
}
阅读此github topic 后,我创建了this stackblitz 示例,但总和未显示在页脚中。
任何人都可以对这个主题有所了解吗?没有这方面的例子。谢谢。
【问题讨论】:
标签: angular html-table sum