【问题标题】:Adjust width of some column in Nz-Table dynamic columns调整 Nz-Table 动态列中某些列的宽度
【发布时间】:2021-10-15 19:35:10
【问题描述】:
我正在使用 Nz-Zorro 即; ng-antd 到设计表。这里我是动态调用表头的。
我有 4 列,我想按其名称减少 2 列的宽度。我该怎么做?
<thead>
<tr>
<th *ngFor="let column of listOfColumns">
{{ column.name }}
</th>
</tr>
</thead>
【问题讨论】:
标签:
angular
antd
ng-zorro-antd
【解决方案1】:
您可以将colWidth: "string" 属性添加到您的每个listOfColumns 项目的类中,并使用您的模型键在您的模型中更改它。然后使用[nzWidth]改变列宽:
<thead>
<tr>
<th *ngFor="let column of listOfColumns" [nzWidth]="column.colWidth">
{{ column.name }}
</th>
</tr>
</thead>