extjs的combobox的change事件

本文探讨了在ExtJS中使用ComboBox时遇到的问题,即当选择非预设值时,change事件导致所有后续选择值相同。同时提到了select事件作为替代方案,通过接收的参数能获取ComboBox实例并读取当前值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果不是‘额’,点击其他combo填入的值都和最后一次触发的相同。‘select’也可以实现(function 中传入的参数不同,combo, records, eOpts),可以获得combo,再获得值

Ext.getCmp('combobox的id')。然后getValue();


items : [{
xtype : 'combobox',
id : 'one',
name : 'one' ,
margin : '12px 4px 4px 4px',
fieldLabel : '一',
store : ['1', '2', '3',  '非'],
listeners : {
                 change : {
                fn : me.changeValue,
                scope : me
                }
                 }
}, {
xtype : 'combobox',
id : 'two',
name : 'two' ,
margin : '12px 4px 4px 4px',
fieldLabel : ' 二',
store : ['1', '2', '3',  '额 '],
listeners : {
                 change : {
                fn : me.changeValue,
                scope : me
                }
                 }
}, {
xtype : 'combobox',
id : 'three',
name : 'three',
margin : '12px 4px 4px 4px',
fieldLabel : ' 三',
store : ['1', '2', '3', '额 '],
listeners : {
                 change : {
                fn : me.changeValue,
                scope : me
                }
                 }
}}]
 
 
changeValue : function(obj, newValue, oldValue, eOpts  ) {
if (newValue != '额') {
var Mond = Ext.getCmp('one');
if (Mond.getValue() != '额') {
 Mond.setValue(newValue);
}
var Tuesd = Ext.getCmp('two');
if (Tuesd.getValue() != '额') {
Tuesd.setValue(newValue);
}
var Wednesd = Ext.getCmp('three');
if (Wednesd.getValue() != '额') {
Wednesd.setValue(newValue);
}
}
}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值