Nested Object
Nested Object
![fahadkhan](https://secure.gravatar.com/avatar/05e37fd54bf5b7a482eb3a0bab123afa/?default=https%3A%2F%2Fvanillicon.com%2F05e37fd54bf5b7a482eb3a0bab123afa_200.png&rating=g&size=120)
Hi,
I am reciveing nested data from API, see the consloe log image below
I am trying to load data
"columns": [
{ "data": "cart.0.productId" },
{ "data": "cart.0.productTitle" },
{ "data": "cart.0.quantity" },
Also tried
"columns": [
{ "data": "productId" },
{ "data": "productTitle" },
{ "data": "quantity" },
But both of the approaches not working. Any idea what I am doing wrong here. I have looked in to the examnple but still could not figure it out.
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
you could use data source to point to "data.cart" as the data source as opposed to using "data".
https://datatables.net/reference/option/ajax.dataSrc
This has a hint, too:
https://datatables.net/examples/ajax/custom_data_flat.html
Perfect
Thanks a lot .