我試圖創建一個引用到行單元格。 這是我的代碼:Jquery Datatables如何獲取渲染函數中的列ID
<table class="table table-striped table-bordered table-hover little_margin_table" id="data-table" width="100%">
<thead>
<th>First Name</th>
<th>Email</th>
<th>Password</th>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
<tr id="@item.Id">
<td>@item.FirstName</td>
<td>@item.Email</td>
<td>@item.Password</td>
</tr>
}
</tbody>
</table>
Javascript代碼:
$(document).ready(function() {
$('#data-table').dataTable({
bFilter: false,
aoColumnDefs: [
{
bSortable: false,
aTargets: [1, 2],
},
{
"targets": 0,
"render": function (data, type, full, meta) {
return '<a href = "@(Url.Action("IndexPage", "Company"))/' + ROWID '</a>';
}
},
]
})
在這裏,我假設行ID:
<tr id="@item.Id">
它怎樣才能進入功能渲染:
"render": function (data, type, full, meta) {
return '<a href = "@(Url.Action("IndexPage", "Company"))/' + ROWID '</a>';
他請給我。