Ext columnModel中的二级联动 大致是 在选中修改时 根据二级学院选择教师 ,下面是部分代码 求解
vargrid_course=newExt.grid.EditorGridPanel({cm:cm_course,ds:ds_course,sm:newExt.grid....
var grid_course =new Ext.grid.EditorGridPanel({
cm : cm_course,
ds : ds_course,
sm : new Ext.grid.RowSelectionModel({
singleSelect : true
}),
listeners : [{
'beforeedit': function(e){
ds_teacher_select.on(
'beforeload', function() {
Ext.apply(this.baseParams, {
departmentId : e.record.data.departmentId
});
});}
}]
});
var cm_course =new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{
header : '开课名称',id : "courseName",menuDisabled : true,sortable : true,width : 100,dataIndex : 'courseName',
editor : new Ext.form.TextField({allowBlank : false,maxLength : 5})},
{
header : '开课单位',width : 140,sortable : true,dataIndex : 'courseDepartmentName',
editor : new Ext.form.ComboBox({
store : ds_department_select,
displayField : 'departmentName',
valueField : 'departmentName',
mode : 'remote',
allowBlank : false,
editable : false,
triggerAction : 'all',
listeners : {
'select' : function(combo, record, index) {
ds_teacher_select.baseParams.departmentId = record.data.departmentId;
ds_teacher_select.removeAll();
ds_teacher_select.reload();
}
}
})
},
{
header : '任课教师',id : "courseTeacherName",sortable : true,width : 100,dataIndex : 'courseTeacherName',
editor : new Ext.form.ComboBox({
store : ds_teacher_select,
displayField : 'teacherName',
valueField : 'teacherName',
id : 'teacherName_combox',
mode : 'remote',
allowBlank : false,
editable : true,
triggerAction : 'all',
listWidth : 160, //因为列宽度默认比较小,所以设定下拉列表宽度
listeners : {
'select' : function(combo, record, index) {
teacherId = record.data.teacherId;
}
}
})},
]); 展开
cm : cm_course,
ds : ds_course,
sm : new Ext.grid.RowSelectionModel({
singleSelect : true
}),
listeners : [{
'beforeedit': function(e){
ds_teacher_select.on(
'beforeload', function() {
Ext.apply(this.baseParams, {
departmentId : e.record.data.departmentId
});
});}
}]
});
var cm_course =new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{
header : '开课名称',id : "courseName",menuDisabled : true,sortable : true,width : 100,dataIndex : 'courseName',
editor : new Ext.form.TextField({allowBlank : false,maxLength : 5})},
{
header : '开课单位',width : 140,sortable : true,dataIndex : 'courseDepartmentName',
editor : new Ext.form.ComboBox({
store : ds_department_select,
displayField : 'departmentName',
valueField : 'departmentName',
mode : 'remote',
allowBlank : false,
editable : false,
triggerAction : 'all',
listeners : {
'select' : function(combo, record, index) {
ds_teacher_select.baseParams.departmentId = record.data.departmentId;
ds_teacher_select.removeAll();
ds_teacher_select.reload();
}
}
})
},
{
header : '任课教师',id : "courseTeacherName",sortable : true,width : 100,dataIndex : 'courseTeacherName',
editor : new Ext.form.ComboBox({
store : ds_teacher_select,
displayField : 'teacherName',
valueField : 'teacherName',
id : 'teacherName_combox',
mode : 'remote',
allowBlank : false,
editable : true,
triggerAction : 'all',
listWidth : 160, //因为列宽度默认比较小,所以设定下拉列表宽度
listeners : {
'select' : function(combo, record, index) {
teacherId = record.data.teacherId;
}
}
})},
]); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询