我有一个包含 4-5 列的 mat-table,但我想在每行下显示另一个属性作为“描述”。我不想按此属性排序或过滤。结果应该如下所示:
Column1 Column2 Column3
------------------------------------------------
Row1Value1 Row1Value2 Row1Value3
Row1ValueDescription that is 3 columns long
------------------------------------------------
Row2Value1 Row2Value2 Row2Value3
Row2ValueDescription that is 3 columns long
------------------------------------------------
这可以用 mat-table 实现吗?还是我必须使用 html 表? 我尝试像这样添加一个 div,但这只是被 ngcontainers 覆盖了:
<mat-row *matRowDef="let element; columns: contentDisplayedColumns">
<div>element.description</div>
</mat-row>
最佳答案
可以按照docs example中的方式进行操作。唯一的区别是使行始终可见。例如。将 [class.example-expanded-row]="expandedElement === element"
更改为 [class.example-expanded-row]="true"
关于html - 将第二个全长行添加到垫表中的每个垫行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71663450/