#################Ext.js 怎么设置文本框不可编辑 #########
代码如下, 根据异议类型来设置 退还资金,。如果异议类型为A,则退还资金 这项只读,其他类型时可以编辑。
var ObjectionForm = new Ext.FormPanel({
frame: true,
labelAlign: 'right',
labelWidth: 90,
width: 200,
height: 350,
items: new Ext.form.FieldSet({
title: '异议信息',
autoHeight: true,
defaults: { width: 185 },
defaultType: 'textfield',
items: [
{
fieldLabel: '编号',
name: 'ID',
readOnly: true,
allowBlank: false
}, {
fieldLabel: '提单号',
name: 'LadingId',
readOnly: true,
allowBlank: false
}, {
fieldLabel: '异议类型',
name: 'ObjectionType',
readOnly: true,
allowBlank: false
}, {
fieldLabel: '异议种类',
name: 'ObjectionMode',
readOnly: true,
allowBlank: false
}, {
fieldLabel: '异议内容',
name: 'ObjectionContent',
readOnly: true,
allowBlank: false
}, {
xtype: 'numberfield',
fieldLabel: '退还资金',
name: 'RefundMoney',
allowBlank: false
}]
})
});
------解决方案--------------------
{
fieldLabel: '异议类型',
name: 'ObjectionType',
readOnly: true,
allowBlank: false,
listeners:{keypress:function(o, e, eOpts){Ext.getCmp('txtMoney').setReadOnly(o.getValue()=='A')}}
}, {
fieldLabel: '异议种类',
name: 'ObjectionMode',
readOnly: true,
allowBlank: false