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>
这就是我如何显示数据,但问题是如何将模型类的地址和分区列合并到单个字段?
答案 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>