我需要将第一列的值传递到第二列 渲染函数() ,以创建一个超链接,其中第一列的值是参数。超链接。
"Columns": [
{
"data": "Code", "autoWidth": true,
},
{ "data" : "StyleReference","autoWidth": true,
"render": function (data, oObj) {
return '<a href="/Production/Styles/StyleDetails/' + Code + '">' + data + '</a>';
}
}
]
请帮助!!
答案 0 :(得分:1)
你快到了。渲染功能最多可能需要4 variables。您的row
代表整个对象,这应该有效:
"columns": [{
"data": "Code",
"autoWidth": true
}, {
"data": "StyleReference",
"autoWidth": true,
"render": function(data, type, row, meta) {
return '<a href="/Production/Styles/StyleDetails/' + row.Code + '">' + data + '</a>';
}
}]
希望有所帮助。