所以我正在使用 JQuery datatables.net(www.datatables.net) 并取得了很大的成功。但最近我尝试添加一些复选框列,但没有取得多大成功。视觉上一切正常,但是当我实际选中/取消选中它时,它不会改变下面的底层值,无论是当我用 chrome 检查元素还是在 javascript 中捕获它时。我是否需要更新表格或其他东西来刷新 DOM 对象?
Javascript创建数据表:
$('#userGroupSettings').dataTable({
"bJQueryUI": true,
"aoColumns": [
/* ID */
{
"bVisible": false
},
/* Group Name */null,
/* Display Group */null,
/* Group Minimised*/null,
/* Send Fault Email*/null],
"aaSorting": [[1, "asc"]]
});
用于创建表的 asp mvc razor 代码:
<table id="userGroupSettings">
<thead>
<th>Group ID</th>
<th>Group Name</th>
<th>Display Group</th>
<th title="When loading the webpage this will determine if the group is minimised or not">Group Minimised</th>
<th title="Send me a fault email when an issue occurs in this group">Send Fault Email</th>
</thead>
<tbody>
@foreach (MvcApplication2.Models.UserGroup group in user.Groups)
{
<tr>
<td>@group.GroupID</td>
<td>@group.GroupName</td>
<td><input class="SettingsDisplayGroup" type="checkbox" name="displayGroup" value="@group.DisplayGroup" @(group.DisplayGroup ? "checked=\"checked\"" : "")/></td>
<td><input class="SettingsMinimiseGroup" type="checkbox" name="minimiseGroup" value="@group.GroupMinimised" @(group.GroupMinimised ? "checked=\"checked\"" : "")/></td>
<td><input class="SettingsSendFaultEmail" type="checkbox" name="sendFaultEmail" value="@group.SendFaultEmail" @(group.SendFaultEmail ? "checked=\"checked\"" : "")/></td>
</tr>
}
</tbody>
</table>
<button id="saveUserGroupSettings">Save</button>
任何帮助表示赞赏