How to insert a hyperlink with dynamic label into datatable
How to insert a hyperlink with dynamic label into datatable
mdhoang
Posts: 1Questions: 0Answers: 0
I followed the example on this link https://datatables.net/reference/option/columns.render and was able to insert the hyperlink into the table. However, I could not make the label of the hyperlink dynamic. Here is my code:
render: function (data, type, row) {
//console.log("data = " + data);
var crab = data.split(" ");
//console.log("minh = " + crab);
var i = 0;
var formatedData = "";
var chipName = data.substring(data.length-6, data.length-1);
return '<a href="'+data+'">chipName</a>';
}
As you can see, I defined chipName as a variable and the its value is from the data. However, with this code, the label for the hyperlink is always "chipName" instead of "ABB109", "ABB110" as expected.
Please help
This discussion has been closed.