最佳答案
我有像你一样的示例任务。我只是很容易用第二个标题显示无。
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef [ngStyle]="{'display': 'none'}"> No. </th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>
<!-- first stage header -->
<ng-container matColumnDef="No">
<th mat-header-cell *matHeaderCellDef [attr.rowspan]="2">No</th>
</ng-container>
这是我的结果
您可以通过我的链接了解更多信息:
StackBlitz
关于angular-material - colSpan 和 row Span 如何添加到 Material 表 Header Angular 7?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55701270/