{
xtype: 'combobox',
fieldLabel: '服务器类型<font color=red>*</font>',
id: 'server_type',
name: 'server_type',
store:[
['1','DataStage'],
['2','PowerCenter']
],
editable: false,
allowBlank: false,
readOnly: true
}
如上面代码,combobox有个readOnly属性,但假设我要使原readOnly=true的combobox恢复成readOnly=false时,比较实用的是调用combobox自身的setReadOnly(boolean)方法。直接修改其readOnly属性(例如Ext.getCmp('server_type').readOnly=false),不会使其显示方式对应修改(依旧显示下拉样式,而不是文本框样式)。
所以个人建议使用:Ext.getCmp('server_type').setReadOnly(false);
ps:firefox查看combobox对象的时候居然没看到有这个方法,看来有些东西还是要去研究下源码哈。