我正在尝试在第一列的每个单元格中创建一个链接,但我遇到了一些麻烦。当我使用以下代码时,我能够按预期看到前六列中的数据。
"aoColumnDefs":
[
{"mDataProp": "Title","aTargets": [0]},
{ "mDataProp": "Body", "aTargets": [1], },
{ "mDataProp": "Feelings", "aTargets": [2] },
{ "mDataProp": "Tags", "aTargets": [3] },
{"mDataProp": "Published","aTargets": [4]},
{ "mDataProp": "LastRevised", "aTargets": [5] },
{
"mDataProp": "Id",
"bVisible": false,
"aTargets": [6]
},
但是,当我尝试根据此示例在标题列中创建链接时:http: //datatables.net/release-datatables/examples/advanced_init/column_render.html
这就是我想出的:
"aoColumnDefs":
[
{"mRender": function (data, type, row) {
return '<a href="@Url.Action("Details", "Table")/"' + row[6]+'">'+data+'</a>';
},
"aTargets": [0]
},
{ "mDataProp": "Body", "aTargets": [1], },
{ "mDataProp": "Feelings", "aTargets": [2] },
{ "mDataProp": "Tags", "aTargets": [3] },
{
"mDataProp": "Published",
"aTargets": [4]
},
{ "mDataProp": "LastRevised", "aTargets": [5] },
{
"mDataProp": "Id",
"bVisible": false,
"aTargets": [6]
},
我想再次显示以前在标题列中的内容,并带有指向每个项目的详细信息视图的链接,但上述内容不起作用。