var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //获取选中的数据 function validChoose() { var d = []; $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) { d.push(this.UserID); }); return d; } function SOCDetailGroupStudent_Save() { //alert(Type); //$("#ID").val(Type); $(document.forms[0]).submit(); } //弹出添加学生页面 function SOCDetailGroupStudent_Add() { var SOCDetailGroupID = $("#SOCDetailGroupID").val(); $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/SOCDetailGroup/StudentAdd?SOCDetailGroupID=' + SOCDetailGroupID + '&MNU=' + mnu, 700, 480, AddStudents_Confirm); } //删除学生名单 function SOCDetailGroupStudent_Delete() { var d = validChoose(); var StudentViewList = $("#dgStudentList").cmsXDataTable("getRows"); var i, j; var len = StudentViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (StudentViewList[i].UserID == d[j]) { StudentViewList.splice(i, 1); break; } } } $("#dgStudentList").cmsXDataTable("loadData", { rows: StudentViewList, total: StudentViewList.length }); } //确定添加学生 function AddStudents_Confirm(StudentList) { if (StudentList == null) return; var StudentViewList = $("#dgStudentList").cmsXDataTable("getRows"); $.each(StudentList, function (index, value) { if ($.grep(StudentViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) { StudentViewList.push({ SelectCourseResultID: $("#SelectCourseResultID").val(), UserID: value.UserID, LoginID: value.LoginID, UserName: value.UserName, SexName: value.SexName, ClassmajorName: value.ClassmajorName, StudentStatusName: value.StudentStatusName, StudentType: value.StudentType, InSchoolStatusName: value.InSchoolStatusName }); } }); $("#dgStudentList").cmsXDataTable("loadData", { rows: StudentViewList, total: StudentViewList.length }); } function reload() { $("#dgStudentList").cmsXDataTable("load", $.getDataGridParams("dgStudentList")); }