Ext readonly 属性后控件光标还能点击,效果跟disabled 效果一样,不同的是这样写值能提交到后台
1.解决 DateField
Ext.extend(Ext.form.DateField, {
initComponent : function(){
JDS.bpm.Form.Field.DateField.superclass.initComponent.call(this);
if (this.readonly){
this.setDisabled(true);
document.getElementById(''+this.getId()+'').UNSELECTABLE="on";
}
}
}),
2.解决 ComboBox
Ext.extend(Ext.form.ComboBox, {
initComponent : function(){
if (this.readonly){
this.setDisabled(true);
}
if(!this.editable){
document.getElementById(''+this.getActionEl().id+'').UNSELECTABLE="on";
document.getElementById(''+this.getEl().id+'').focus=true;
}
}
})
其他的控件照些就行,如果你不喜欢继承, 你可以重写控件的 initComponent 方法,推荐重写