Trying to sort a table in PrimeNG table which has a field which is generated as a multiplication of values of two other fields. My problem here is that I can't modify the object array which the table is based on but so i need to multiply them as an angular expression and add it to the table. But I also need to sort the table with this field, which does not have a field name, since it is calculated through expression. How do I specify this field in pSortableColumn or field name? Now I am able to sort with all fields except the one being calculated.
<tr>
<th [pSortableColumn]="prop.field" *ngFor="let prop of fieldList">{{prop.header}} <p-sortIcon [field]="prop.field"></p-sortIcon></th>
<th [pSortableColumn]="">Product<p-sortIcon [field]=""></p-sortIcon></th>
</tr>
<tr>
<td *ngFor="let prop of fieldList">
{{ rowData[prop.field] }}
</td>
<td>
{{+rowData['Qty'] * +rowData['Cost']}}
</td>
</tr>