I have a json data like following,and I am trying to present this data in the table format but unable to bind in the expected way. can someone please let me know if we can achieve this with p-table ?
here is what I am trying, but duplicate records can be seen row wise as let-car is loop thhrough the data.
data:
{
Year: 2023,
InputData: {
OilProduction: 0,
GasProduction: 0,
NGLProduction: 0,
},
},
{
Year: 2024,
InputData: {
OilProduction: 1,
GasProduction: 2,
NGLProduction: 3,
},
},
];
Expected design of the table:
| parameter | 2023 | 2024 |
|---|---|---|
| oil production | 0 | 1 |
| gas production | 0 | 2 |
| NGL production | 0 | 3 |
Its not the best, but it gets the job done!
hashMapof the values on the array with the key being theyearand the values.trelements, we only need one which will be used for all the rows!ts
html
stackblitz