editorgridpanel 一列即有combobox 又有TextField ,如何实现

greatmind829 2011-06-28 10:22:01
我的代码,不知道如何加编辑框,假设isEditor为1加combobox 为0加TextField ,请帮忙解决一下,谢谢了。



systemConfigJsonStore = Ext.extend(Ext.data.JsonStore, {
constructor : function() {
systemConfigJsonStore.superclass.constructor.call(this, {
url : "systemConfig/SystemConfigOper!findSystemConfig.action",
root : 'root',
totalProperty : 'totalProperty',
fields : [{
name : "id"

}, {
name : "systemConfigName"
}, {
name : "systemConfigValue"
}, {
name : "systemConfigInfo"
},{
name:'editorValue'
},
{
name:'defaultValue'
}
]
,autoLoad :true
});
}
});



systemConfigGridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
configStore:null,
constructor : function() {
configStore=new systemConfigJsonStore();

var cm = new Ext.grid.ColumnModel([
{
header : "系统信息名称",
sortable : true,
dataIndex : 'systemConfigName'
}, {
header : '系统信息值',
dataIndex : 'systemConfigValue',
sortable : true/*,
editor: new Ext.form.Field({
allowBlank: false,
allowNegative: false,
maxValue: 100000
})
*/
},
{
header : '系统信息说明',
dataIndex : 'systemConfigInfo',
sortable : true

}


]);

systemConfigGridPanel.superclass.constructor.call(this, {
region:"center",
split:true,
title : '系统配置',
store : configStore,
loadMask : true,
margins : '-1',
viewConfig : {
forceFit : true,
columnsText : '列',
sortAscText : '升序',
sortDescText : '降序'
},
cm: cm,
listeners:{
'afteredit':function (e){
var r = e.record; //得到当前行所有数据
var f = e.field; //得到修改列

},
'beforeedit':function (e){
var isEditor=e.record.data.editorValue;
var r=e.row;
var f = e.field; //得到修改列

if (isEditor == 0){
e.cancel = true;
}



},
'cellclick':function (grid,row,num,e){
//grid.startEditing(row,num);
var record = grid.getStore().getAt(row); // Get the Record
var fieldName = grid.getColumnModel().getDataIndex(num); // Get field
var isEditor = record.get("editorValue");
// alert("num--"+num);
if (isEditor == 1){

grid.view.cm.setEditor(num,new Ext.form.Field({ //这样加进去之后报错,应怎么加。
allowBlank: false,
allowNegative: false

}))
}
}
}
})
}

})



...全文
145 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
greatmind829 2011-06-28
  • 打赏
  • 举报
回复
已解决了。来者有分。。
greatmind829 2011-06-28
  • 打赏
  • 举报
回复
自己顶。沉了。。
lsw645645645 2011-06-28
  • 打赏
  • 举报
回复
我要分
一品 2011-06-28
  • 打赏
  • 举报
回复
beforeedit去判断后渲染

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧