Optimist Rohit
Optimist Rohit

Reputation: 428

Adjust width of some column in Nz-Table dynamic columns

I am using Nz-Zorro ie; ng-antd to design table. Here I am dynamically calling the table header.

I have 4 columns and I want reduce the width of 2 columns by its name. How can I do that ?

<thead>
   <tr>
     <th *ngFor="let column of listOfColumns">
       {{ column.name }}
     </th>
   </tr>
</thead>

Upvotes: 2

Views: 4567

Answers (1)

Mazdak
Mazdak

Reputation: 700

you can add a colWidth: "string" property to each of your listOfColumns item's class and change it in your model with your model key. then use [nzWidth] to change the column width:

<thead>
   <tr>
     <th  *ngFor="let column of listOfColumns" [nzWidth]="column.colWidth">
       {{ column.name }}
     </th>
   </tr>
</thead>

Upvotes: 2

Related Questions