我使用primeng数据表来显示一些数据,我想将2列组合到单个<p-column>字段?

时间:2017-01-06 06:03:25

标签: angular primeng

export class Model
{
    public name:string;
    public phone_number:string;
    public profession:string;
    public address:string;
    public district:string;
    public membership:string;
}

    this is my model class data format.     

<p-column field="name" header="Name"></p-column>
<p-column field="phone_number" header="Phone Number"></p-column>
<p-column field="profession" header="Profession"></p-column>
<p-column field="address" header="Address"></p-column>

这就是我如何显示数据,但问题是如何将模型类的地址和分区列合并到单个字段?

1 个答案:

答案 0 :(得分:2)

使用模板可以这样做:

<p-column field="address" header="Address - (District)">
   <template let-col let-user="rowData" pTemplate="body">
       <span>
           {{user['address'] - (user['district'])}}
       </span>
   </template>
</p-column>