无法在棱角材料表中使用colspan

问题描述 投票:0回答:2

是否可以在有角度的材质表中使用colspan,或者是否可以通过其他任何方式实现colspan?

我尝试过[attr.colspan],但结果不正确。enter image description here

angular typescript html-table expand material
2个回答
0
投票

您不能在物料表中使用colspan。您可以设置[matColumnDef]来定义需要显示的列。或者[attr.colspan]是您可以在垫子桌子上使用的属性。尽管我自己还没有尝试过。

mat表格的列定义。定义一组可用于表列的单元格。

Angular Material Table API

如果您真的想使用colspan,可以阅读THIS线程,其中说明了如何将colspan与CdkTable一起使用。


0
投票

您可以使用[attr.colspan]这是一个示例

    <table mat-table [dataSource]="dataSource" multiTemplateDataRows>
    <ng-container matColumnDef="column">
      <th mat-header-cell *matHeaderCellDef [attr.colspan]="3">Column</th>
    </ng-container>
    </table>
© www.soinside.com 2019 - 2024. All rights reserved.