我正在使用具有3件事的ng-container处理材料表:
a)th(mat-header-cell)
b)td(mat-cell)
c)td(mat-footer-cell)
在此表中,页脚行(前几行的数据总计)当前正按预期显示在表底部,但对于此业务案例,他们需要总计行(mat-footer-cell)出现在最佳。我应该如何处理?
这是该表的摘录:
<table mat-table class="status-table" [dataSource]="statSource" matSort #statSort="matSort">
<ng-container matColumnDef="argName">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="make-blue" scope="col">
ArgName
</th>
<td mat-cell class="cursor-pointer"
(click)="setTableProperties(this.formatMyData, 'first', 'second', arg.argTitle)"
*matCellDef="let area">
{{ arg.argTitle | uppercase }}
</td>
<td mat-footer-cell *matFooterCellDef>Total</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="statCols"></tr>
<tr mat-row *matRowDef="let row; columns: statCols"></tr>
<tr mat-footer-row *matFooterRowDef="statCols"></tr>
</table>
我尝试制作多个表头并将页脚分成自己的ng-container,但这似乎令人难以置信地多余,并且无法正常工作。重新排列trs时不起作用。因此,也许可能会有其他巧妙的方式来定义多个没有冗余的垫头,或者简单地操纵当前的表解剖结构来适应这种情况,但这是我的知识有限的地方。
因此,总而言之,我需要将页脚行移动到数据上方,该行将位于当前页眉列的正下方。
答案 0 :(得分:0)
我选择执行以下操作,并装饰一些看起来像这样的样式:`
<ng-container matColumnDef="argName">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="make-blue" scope="col">
<div>ArgName</div>
<div>Total</div>
</th>
<td mat-cell class="cursor-pointer"
(click)="setTableProperties(this.formatMyData, 'first', 'second', arg.argTitle)"
*matCellDef="let area">
{{ arg.argTitle | uppercase }}
</td>
<!--<td mat-footer-cell *matFooterCellDef>Total</td>-->
</ng-container>
<tr mat-header-row *matHeaderRowDef="statCols"></tr>
<tr mat-row *matRowDef="let row; columns: statCols"></tr>
<!--<tr mat-footer-row *matFooterRowDef="statCols"></tr>-->
`