Can I use a function when working with nested object data?
Can I use a function when working with nested object data?
dsnap
Posts: 23Questions: 3Answers: 0
Looking at this, http://datatables.net/examples/ajax/objects_subarrays.html.
Using 1.10.3.
Instead of separating a nested array with commas I want to make a link.
<a href="linking/to/here/#{multiple.account_hash}">{multiple.name}</a>
var ajax = {
"aaData":
[ {
"id":"1",
"multiple": [
[
"name":"New 1",
"account_hash":"826ab3413acb4b03af40d75412d21aaf"
]
]
}]
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sure - use
columns.data
to point tomultiple
andcolumns.render
to create the link based on the data:edit - you don't have to handle the
display
type specifically - DataTables would strip the HTML for sorting and filtering, but I think it is probably good practice.Allan
Threw you some money!
Hmm, what if I also wanted "id" in the link?
I tried turning
into
but that seemed to put the entire response in each row...
The
row
parameter (3rd one passed in) provides access to the full data source object, you could userow.id
.Equally, you could actually use
row.multiple.account_hash
if you wanted... :-)Allan
Thanks, Allan! Computers are hard!
Its keyboards I have a problem with - when my head connects with them :-)
Allan