function Announcement_RoleAdd() { $.popupTopWindow('选择发布角色', CMS_SystemConfig.VirtualDirectoryPath + '/Common/RoleSelector', 620, 360, Announcement_RoleAdd_Confirm); } function Announcement_RoleAdd_Confirm(roleList) { if (!roleList) return; var roleViewList = $("#dgRoleList").cmsXDataTable("getRows"); $.each(roleList, function (index, value) { if ($.grep(roleViewList, function (row, index) { return value.RoleID == row.RoleID; }).length == 0) { roleViewList.push({ RoleID: value.RoleID, OrderNo: value.OrderNo, RoleName: value.RoleName, DefaultDataRangeDesc: value.DefaultDataRangeDesc, RecordStatusDesc: value.RecordStatusDesc, Description: value.Description }); } $("#dgRoleList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length }); }); } function validChoose() { var d = []; $.each($("#dgRoleList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } function Announcement_RoleDelete() { var d = validChoose(); var roleViewList = $("#dgRoleList").cmsXDataTable("getRows"); var i, j; var len = roleViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (roleViewList[i].RoleID == d[j].RoleID) { roleViewList.splice(i, 1); break; } } } $("#dgRoleList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length }); }