我如何这样做,姓名和姓氏在同一列?
<p-dataTable [value]="users" expandableRows="true" selectionMode="single"
[(selection)]="selectedUser" (onRowSelect)="onRowSelect($event)"
[paginator]="true" [rows]="10" [globalFilter]="gb" #dt>
<p-column expander="true" styleClass="col-icon"></p-column>
<p-column field="id" header="Identificador"></p-column>
<p-column field="name" header="Names"></p-column>
<p-column field="surname" header="Surnames"></p-column>
</p-dataTable>
答案 0 :(得分:1)
使用templating功能。类似的东西:
<p-column field="name" header="Names">
<ng-template let-user="rowData" pTemplate="body">
{{user.name}} {{user.surname}}
</ng-template>
</p-column>
请参阅StackBlitz