本文主要包含datagrid,checkbox,easyui等相关知识,天堂向左希望在学习及工作中可以帮助到您
代码示例
//弹出角色设置窗口
function AuthoritySetting() {
//绑定新值
var row = $('#dg').datagrid('getSelected');
if (row) {
$('#dlgAuthoritySetting').dialog('open');
$('#tbxRoleCode').textbox('setValue', row.角色代码);
$('#tbxRoleName').textbox('setValue', row.角色名称);
$.ajax({
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
url: "../../Controller/Interface/ComAuthority.ashx?Action=BindRole",
type: "get",
data: {
"roleCode": encodeURIComponent($('#tbxRoleCode').textbox('getText')),
},
dataType: "json",
success: function (data) {
$("#dgrole").datagrid("options").pageNumber = 1;
$("#dgrole").datagrid("loadData", data);
if (data) {
$.each(data.rows, function (index, item) {
if (item.checked == "True") {
$('#dgrole').datagrid('checkRow', index);
}
else {
$('#dgrole').datagrid('uncheckRow', index);
}
});
}
}
});
}
}
核心部分
if (data) {
$.each(data.rows, function (index, item) {
if (item.checked == "True") {
$('#dgrole').datagrid('checkRow', index);
}
else {
$('#dgrole').datagrid('uncheckRow', index);
}
});
}