0

Is there a way in p-table to show the value instead of Id?

Eg: I get the data from server as below

[
   {row_id: 1, customer_id: 25, status: 'NEW'},
   {row_id: 1, customer_id: 26, status: 'NEW'},
]

I want to replace the customer id with customer name in the p-table with shows above data. I have the mapping of customer id to customer name as below

[
   {rowid: 25, name: 'Vinod'},
   {row_id: 26, name: 'Ram'}
]

Edit I achieved this using Angular Pipe. But is there a p-table way of doing it?

1 Answers1

0

You could keep you mapping array as below instead.

this.mapping = {
   25: {name: 'Vinod', age: 25},
   26: {name: 'Ram'}
}

and in your html as below.

<td>mapping[rowData['customer_id']].name</td>
Zam Abdul Vahid
  • 2,389
  • 3
  • 18
  • 25