0
我想在第一列的每個單元格中創建一個鏈接,但我遇到了一些麻煩。當我使用下面的代碼時,我能夠按照預期在前六列中看到數據。datatables mrender問題asp.net
"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]
},
我想要顯示的內容那些以前在標題欄中的鏈接指向每個項目的詳細信息視圖,但上述內容不起作用。