I have a server side data as following for a jQuery datatable.
"data": [
{
"id": 1,
"title": 'Hello World"
"category": [
{
"id": 1,
"title": "Hello World"
},
{
"id": 1,
"title": "Foo Bar"
},
]
}
]
Now I needs to show these "categories" as a hyperlink in the category column cells of my datatable and it should be comma seperated like following
Source: <a href="ID">Hello World</a>, <a href="ID">Foo Bar</a>
Example: Hello World, Foo Bar etc...
I already can render this as comma separated using "render": "[, ].title" but not this level as as a hyperlink. Can anyone help me?
EDIT
{ data: 'category',
render: function ( data, type, full, meta ) {
$.each(data.category, function( index, value ) {
return value.title;
});
}
},
This is what I have done so far. But still not working. All I needs to pass title and id into this loop. So I can use it to build a hyperlink.
renderalso accepts a functionrender: function ( data, type, row )so just build the list of hyperlinks there.data.category.titleis the trick but it is not working for this second level.data.categoryis an array sodata.category.titleis not going to work. You need to loop overdata.category.