所以我使用的是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>
任何帮助表示赞赏