I am trying to use ag-grid with an api that gives the following code
{
"rates": {
"btc": {
"name": "Bitcoin",
"unit": "BTC",
"value": 1,
"type": "crypto"
},
(snip)
}
And my ag-grid is set up in the following way
<AgGridReact
rowSelection="multiple"
rowData={rowData}>
<AgGridColumn field="btc" filter={true} checkboxSelection={true} sortable={true}></AgGridColumn>
<AgGridColumn field="eth" filter={true} checkboxSelection={true} sortable={true}></AgGridColumn>
<AgGridColumn field="ltc" filter={true} checkboxSelection={true} sortable={true}></AgGridColumn>
</AgGridReact>
So far that is giving me an error. I am not understanding why, because the code is working fine when I use a different api. The other api returns the following
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
And my working grid is set up in the following way
<AgGridReact
rowSelection="multiple"
rowData={rowData}>
<AgGridColumn field="name" filter={true} checkboxSelection={true} sortable={true}></AgGridColumn>
<AgGridColumn field="phone" filter={true} checkboxSelection={true} sortable={true}></AgGridColumn>
<AgGridColumn field="email" filter={true} checkboxSelection={true} sortable={true}></AgGridColumn>
</AgGridReact>
I've noticed that the difference is the working api is an array of objects, while the one that is not working is an object with nested objects.
The full code is here for anyone to view
thanks in advance for your help.