【发布时间】:2015-07-24 11:48:49
【问题描述】:
我有一个布尔字段,比如一个标志来说明该行是否在表中被删除。它使用复选框显示,因此如果数据已被删除,则复选框值为true,反之亦然。
下面是显示表格的代码:
<table id="tblEvent" class="display" cellspacing="0" style="width: 100%">
<thead>
<tr>
<th>@Html.DisplayNameFor(model => model.PIC)</th>
<th>@Html.DisplayNameFor(model => model.Name)</th>
<th>@Html.DisplayNameFor(model => model.StartDate)</th>
<th>@Html.DisplayNameFor(model => model.Status)</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.PIC)</td>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@Html.DisplayFor(modelItem => item.StartDate)</td>
<td>@Html.EditorFor(modelItem => item.Status)</td>
</tr>
}
</tbody>
</table>
$(document).ready(function () {
$("#tblEvent").dataTable({
"order": [[1, "desc"]]
});
});
在表格中,我可以单击复选框,但我不知道如何处理单击事件,因为我正在使用数据表来显示数据。如何使用数据表处理复选框事件?
【问题讨论】:
-
$('#tblEvent input[type="checkbox"]).click(function() { ...
标签: javascript jquery asp.net-mvc datatables