How can I add a class to a cell depending on field value?
<p-dataTable [value]="invoices" tableStyleClass="table-invoices">
<p-column field="status" header="Status" styleClass="mini status">
<ng-template pTemplate="body" let-col let-inv="rowData">
{{inv.status}}
</ng-template>
</p-column>
</p-dataTable>
I know how to add class to all cells in a column, but I need to give a class to cells (<td>
) individually, depending on the value stored in status
, so some cells in a column will have the class and some others in the same column won't.
Edited: I know how to give a class to a HTML element inside the <td>
, but I want to know if it's possible to give a class to the <td>
itself.