Can I use a function when working with nested object data?
Can I use a function when working with nested object data?
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.datato point tomultipleandcolumns.renderto create the link based on the data:edit - you don't have to handle the
displaytype 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
rowparameter (3rd one passed in) provides access to the full data source object, you could userow.id.Equally, you could actually use
row.multiple.account_hashif you wanted... :-)Allan
Thanks, Allan! Computers are hard!
Its keyboards I have a problem with - when my head connects with them :-)
Allan