how to add link for each row ?
how to add link for each row ?
bussiere
Posts: 1Questions: 1Answers: 0
Cid is in array with links how to parse cid and put each value as a link instead url in the funtion in mrender ?
My code :
var data_in_table = {
"cid" : cid,
"aaData": [
],
"aoColumnDefs": [{
"aTargets": [0]
, "bSortable": true
, "mRender": function (url, type, full,cid) {
return '<a href="' + url + '">' + url + '</a>';
}
},{
"aTargets": [3]
, "bSortable": true
, "mRender": function (data, type, full) {
return data;
}
}]
};
console.log("data_table",data_table['aaData']);
data_in_table["aaData"] = data_table['aaData'];
$('#table_data').dataTable(data_in_table);
and i imagine that i would like something like this :
var data_in_table = {
"cid" : cid,
"aaData": [
],
"aoColumnDefs": [{
"aTargets": [0]
, "bSortable": true
, "mRender": function (url, type, full,cid) {
return '<a href="' + cid[i] + '">' + url + '</a>';
}
},{
"aTargets": [3]
, "bSortable": true
, "mRender": function (data, type, full) {
return data;
}
}]
};
console.log("data_table",data_table['aaData']);
data_in_table["aaData"] = data_table['aaData'];
$('#table_data').dataTable(data_in_table);
how to get the i ?
Regards and thanks
This discussion has been closed.
Answers
Its virtually impossible to say for certain without a link to a test case, as required in the forum rules, but you probably need to do something like
full[ index ]
whereindex
is the data index that contains the URL.Allan