Generate Child Row from Nested Object Using Ajax
Generate Child Row from Nested Object Using Ajax
potato_code
Posts: 14Questions: 5Answers: 0
Hi,
I'm trying to loop through the nested object that contains an array. I am able to successfully render it in the main table as a td but not as a child row (it returns object object). I'm not sure if I'm missing something.
This question has an accepted answers - jump to answer
Answers
The
value
variable is an object, for example:{office: 'London'}
. You need to usevalue.office
to haveLondon
displayed. See this updated example:http://live.datatables.net/rifeheko/4/edit
Kevin
Hi,
Thanks for the reply. It works in the updated example however when I try in my project files a error in the console shows:
Uncaught TypeError: Cannot read properties of undefined (reading 'location')
When I try to console.log(d) it comes back as undefined
Undefined means
d
doesn't exist in the function. The example hasfunction format(d){...}
. Do you haved
as the parameter?Kevin
Hi,
I realized my mistake was that I was referencing the wrong table on
td.details-control
click.Thanks for the help