你需要使用模板
frozenheader
<ng-template pTemplate="frozenheader" let-columns>
<tr>
<th>All</th>
<th *ngFor="let col of columns">
{{col.header}}
</th>
</tr>
</ng-template>
和
frozenbody
<ng-template pTemplate="frozenbody" let-rowData let-columns="columns">
<tr>
<td style="text-align: center">
<p-tableCheckbox [value]="rowData" [attr.disabled]="
rowData.setupType === 'No Action' &&
rowData.currentStatus === 'INACTIVE'
? 'disabled'
: null
"></p-tableCheckbox>
</td>
<td *ngFor="let col of columns">
{{ rowData[col.field] }}
</td>
</tr>
</ng-template>
演示
here