DataTables.Net Link 项
DataTables.Net Link on item
如何在我的第一行创建一个 link 来命中我的家庭控制器的事务操作。我已经玩了大约半天了,但似乎无法正确处理。下面是我的数据表代码。
$(document).ready(function () {
DT = $('#transactionsTable').DataTable({
"processing": true,
"clientSide": true,
"ajax": {
url: '/Transaction/TransactionsData',
data: function (d) {
d.state = $('#stateSelect option:selected').val();
},
type: "POST",
dataType: "json"
},
"columns": [
{ "title": "TransactionID" },
{ "title": "WestWaterID" },
{ "title": "ResearchNotes" },
{ "title": "SaleDate", "type": "date" },
{ "title": "Westimate" },
{ "title": "TotalPrice" }]
});
});
像这样:
columns: [
{ title: "TransactionID",
render: function(data, type, row) {
return '<a href="'+data+'">'+TransactionID+'</a>'
}
},
{ "title": "WestWaterID" },
{ "title": "ResearchNotes" },
{ "title": "SaleDate", "type": "date" },
{ "title": "Westimate" },
{ "title": "TotalPrice" }
]
这里我只是猜测 link 在 data
.
如何在我的第一行创建一个 link 来命中我的家庭控制器的事务操作。我已经玩了大约半天了,但似乎无法正确处理。下面是我的数据表代码。
$(document).ready(function () {
DT = $('#transactionsTable').DataTable({
"processing": true,
"clientSide": true,
"ajax": {
url: '/Transaction/TransactionsData',
data: function (d) {
d.state = $('#stateSelect option:selected').val();
},
type: "POST",
dataType: "json"
},
"columns": [
{ "title": "TransactionID" },
{ "title": "WestWaterID" },
{ "title": "ResearchNotes" },
{ "title": "SaleDate", "type": "date" },
{ "title": "Westimate" },
{ "title": "TotalPrice" }]
});
});
像这样:
columns: [
{ title: "TransactionID",
render: function(data, type, row) {
return '<a href="'+data+'">'+TransactionID+'</a>'
}
},
{ "title": "WestWaterID" },
{ "title": "ResearchNotes" },
{ "title": "SaleDate", "type": "date" },
{ "title": "Westimate" },
{ "title": "TotalPrice" }
]
这里我只是猜测 link 在 data
.