Nested Json
Nested Json
al_1976
Posts: 9Questions: 3Answers: 0
Hi
Excuse the newbie question but its driving me up the wall and any help would be much appreciated. I have a nested JSON object called activity. If this has values I want to display them (ideally wrapped in html). If they are no values I just want to display some default text.
Hopefully this simple example will make it clear http://live.datatables.net/radabaye/1/
Many thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
activity
is an array so you would need to use array syntax ("activity[].timestamp"
for example) - seecolumn.data
for more information about this. Or usecolumn.render
if you want to format them with some HTML.Allan
That's great thanks for your help. I'm still have a little trouble getting my head around it . I have updated the link to my latest work. What I really what to do is take the data in activity array and create another table from it within the current cell, is that possible?
Thanks again for you time I really appreciate it
http://live.datatables.net/radabaye/1/
You are going to need to explain that a bit further for me please. Do you simply want the data in the array shown in a
<table>
inside the DataTable cell?You could use
columns.render
to produce the HTML needed for that table if so.Allan
Hi Allan
That's exactly what I want to do. If the activity array has data I want to create a table using that data inside the DataTable cell. I have looked at columns.render but I can't seem to get it to work. No errors it just doesn't display anything.
Could I be really cheeky and ask for some example to code to push me in the right direction please? I must be doing something stupid
Many Thanks
Something like:
It isn't a
table
I know - but hopefully you can fill in the blanks using the above :-)Allan
Thats briliant thanks