static.scripts.common.departTeacher2Select.js Maven / Gradle / Ivy
var teaching=[null,true,false];
//页面上的所有部门教师的二级选择
var departTeacherSelects=new Array();
//异步操作中的教师选择缓冲区
var teacherSelectIds=new Array();
//初始化教师所在部门
function initTeachDepartSelect(departs){
dwr.util.removeAllOptions(this.teachDepartSelectId);
dwr.util.addOptions(this.teachDepartSelectId,departs,'id','name');
document.getElementById(this.teachDepartSelectId).onchange=function (event){notifyTeacherChange(event)};
setSelected(document.getElementById(this.teachDepartSelectId),this.defaultTeachDepartId);
}
//初始化教师列表
function initTeacherSelect(){
dwr.util.removeAllOptions(this.teacherSelectId);
if(this.teacherIdNullable){
dwr.util.addOptions(this.teacherSelectId,[{'id':'','name':'请选择...'}],'id','name');
}
var s= document.getElementById(this.teachDepartSelectId);
if(s.value!=""){
teacherSelectIds.push(this.teacherSelectId);
//alert(teacherSelectIds+"after init push");
teacherDao.getTeacherNamesByDepart(s.value,teaching[this.isTeaching],setTeacherOptions);
}
}
//通知教师列表
function notifyTeacherChange(event){
var curDepartTeacherSelect= getCurDepartTeacherSelect(getEventTarget(event).id);
if(null==curDepartTeacherSelect)return;
dwr.util.removeAllOptions(curDepartTeacherSelect.teacherSelectId);
if(curDepartTeacherSelect.teacherIdNullable){
dwr.util.addOptions(curDepartTeacherSelect.teacherSelectId,[{'id':'','name':'请选择...'}],'id','name');
}
var s= document.getElementById(curDepartTeacherSelect.teachDepartSelectId);
if(s.value!=""){
teacherSelectIds.push(curDepartTeacherSelect.teacherSelectId);
//alert(teacherSelectIds+"after notifyTeacherChange push");
teacherDao.getTeacherNamesByDepart(s.value,teaching[curDepartTeacherSelect.isTeaching],setTeacherOptions);
}
}
//得到现有的教师和部门选择
function getCurDepartTeacherSelect(departId){
for(var i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy