How to use template in <p-datatable>
Each p-column
can have two templates - body
and header
, you should specify which one it is. It's not mandatory because body
is default I think and this is what you need in this case, but it's good practice. You also need to add pTemplate
to template in order for p-column
to use it, this is the reason p-column
won't display template you provided. So, your code should look like this:
<p-dataTable [hidden]="loading" [value]="files" selectionMode="single" sortField="Status" [sortOrder]="-1"> <p-column field="FileName" header="Naam" sortable="true"></p-column> <p-column field="Status" header="Status" sortable="true"> <ng-template let-file="rowData" pTemplate type="body"> {{file.Status == 1 ? "Yes" : "No"}} </ng-template> </p-column></p-dataTable>