Sliding child rows, how to change the format function to work with nested json ?
Sliding child rows, how to change the format function to work with nested json ?
mlotfi
Posts: 60Questions: 5Answers: 0
This page show a nice sliding row :
http://datatables.net/blog/2014-10-02
let say we have a nested json :
{
"data": [
{
"name": "Tiger Nixon",
"position": "System Architect",
"salary": "$320,800",
"start_date": "2011/04/25",
"office": "Edinburgh",
"extn": "5421",
"agencies": {
"name": "agency2",
"name": "agency5",
"name": "agency24",
},
"globals": {
"name": "global42",
"name": "global13",
"name": "global4",
}
},
......
......
{
"name": "Donna Snider",
"position": "Customer Support",
"salary": "$112,000",
"start_date": "2011/01/25",
"office": "New York",
"extn": "4226",
"agencies": {
"name": "agency23",
"name": "agency56",
"name": "agency2",
},
"globals": {
"name": "global2",
"name": "global13",
"name": "global45",
}
}
]
}
This discussion has been closed.
Replies
How to change the format function in that slide example to work with this json format ?
Thanks
The
format
function is just being passed in the data obejct for each row. So you might usedata.agencies.name
(btw your JSON looks very odd asname
inagencies
andglobal
is repeated multiple times).Allan
Thanks allan,
I think I should put an array instead of name in agencies and global :
"agencies" : ["agency23", "agency56"]
"globals" : ["global2", "global13"]