public String peClassInfo(){
String classId ="";
if(!"".equals(classIds)){
String[] classObj = classIds.split("or");
for(String str :classObj){
classId = classId+"'" +str.toString().trim() +"'";
}
}
StringBuffer sBuffer = new StringBuffer();
sBuffer.append(" select c.name as name,count(s.id) as id ");
sBuffer.append(" from pe_class c,pe_student s ");
sBuffer.append(" where s.fk_class_id=c.id ");
sBuffer.append(" and c.id in ("+classId+")");
sBuffer.append(" group by c.name ");
try {
List list1=this.getGeneralService().getBySQL(sBuffer.toString());
if(null!=list1 && list1.size()>0){
JsonConfig config = new JsonConfig();
JSONArray json = JSONArray.fromObject(list1,config);
response().setContentType("text/html");
try {
request().setCharacterEncoding("UTF-8");
response().setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PrintWriter out;
try {
out = response().getWriter();
out.print(json);
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (EntityException e) {
e.printStackTrace();
}
return null;
}
----------------------------------------------------
$(document).ready(function(){
$("#peClassRoom").click(function() {
var courseRoomId = $("#courseRoomId").val();
if(courseRoomId==""){
alert("请先进行教室选择");
}else{
$.ajax({
type:'post',
url:encodeURI('courseScheduling_peClassRoomInfo.action?courseRoomId='+courseRoomId),
dataType:'json',
success:function(json){
if(json==null){
$("#myJiaoshi").hide();
alert("选择的教室不是上课教室");
}else{
var listitem=new Array();
listitem = eval(json);
//var row = $("#cnt1").insertRow();
//var cell = row.insertCell(0);
for(var i=0;i<listitem.length;i++){
var className=listitem[i][0];
//alert(className);
var classsite=listitem[i][1];
var classNum=listitem[i][2];
$("#myJiaoshi").show();
$("#roomName").html(className);
$("#roomSite").html(classsite);
$("#roomNum").html(classNum);
}
}
}
});
}
});
});
-----------------------------------------------------------------------------------------
var classCombo = new Ext.form.MultiSelect({
width: 195,
emptyText : '请选择班级',
hiddenName: 'classIds',
displayField:'name',
valueField: 'id' ,
fieldLabel: '班级',
editable: false,
typeAhead: true,
store: new Ext.data.JsonStore({
fields: ['id', 'name'],
id: 'id',
data:<s:action name='myList' namespace='/test' executeResult='true' ><s:param name='sql'>select distinct c.id,c.name from pr_tch_opencourse_plan p,pe_class c, pe_grade g,pe_tch_course co,
pe_site s ,pe_semester sm ,pe_edutype pe where p.fk_grade=g.id and p.fk_site_id=s.id and p.fk_class_id=c.id and p.fk_semester_id=sm.id
and p.fk_course_id=co.id and s.id='<s:property value="siteId"/>' and sm.id='<s:property value="semesterId"/>'
and co.id='<s:property value="courseId"/>' and g.id='<s:property value="graeId"/>' and pe.id='<s:property value="edutypeId"/>' </s:param></s:action>,
autoLoad:true,
root:'models'
}),
mode: 'local',
triggerAction: 'all'
});
classCombo.render('className');