I have a data table with link on some of the rows to allow users to view details of selected record. I have the following on "View" cell and associated js function:
columns: [
{
....
},{
"render": function (data, type, row) {
var active = row.Active;
var today = new Date();
var startDate = new Date(row.StartDate)
var cellContent = "";
if (startDate > today && active == true) {
cellContent = "<span class=\"PageLink\"><a href='javascript:' onclick=\"setDetailFields(" + row + ")\">View</a></span>";
}
return cellContent;
}
},{
....
}
],
function setDetailFields(record) {
clear();
var reqID = record.RequestID;
var reqName = record.RequesterName;
....
}
When I click the "View" link I get the following JS error:
// JavaScript critical error at line 19, column 1 in (unknown source location)\n\nSCRIPT1007: Expected ']'
debugger shows the following code block when error occurs:
function onclick(event)
{
setDetailFields([object Object])
}
[object Object]is not valid JS syntax; what were you intending to do?