Is possible to add hyper link on datatable columns?
Is possible to add hyper link on datatable columns?
carloawpogi
Posts: 2Questions: 2Answers: 0
is it possible to add a hyperlink in datatable columns to redirect to other page?
This is my example
function LoadClassRecordSummary(gradingPeriod) {
$.ajax({
type: "GET",
url: '@Url.Action("GetClassRecordSummary", "ClassRecord")',
data: { gradingPeriodID: gradingPeriod },
success: function (data) {
data = JSON.parse(data)
var cols = [];
var exampleRecord = data[0];
var keys = Object.keys(exampleRecord);
keys.forEach(function (k) {
cols.push({
title: k,
data: k
});
});
var table = $('#ClassRecordList').DataTable({
destroy:true,
columns: cols,
"responsive": true,
});
table.clear();
table.rows.add(data).draw();
return table;
},
error: function (xhr, status, exception) {
console.log("Error: " + exception + ", Status: " + status);
}
})
}
This discussion has been closed.
Answers
Here is an example:
from the table's columns data part: