增加radiogroup事件,不知是不是你所需要的
{
xtype : 'radiogroup',
fieldLabel : '性别,
id : sex,
columns : 2,
items : [{boxLabel : '男, name :' man', inputValue : 'man',checked : true,},
{boxLabel : '女, name : 'woman', inputValue : 'woman',}
],
//以下是监听事件
listeners : {
change : function(radiofield,oldvalue){//这事件是当radiogroup的值发生改变时进入
alert(radiofield.getValue());//输出选中的值
alert(oldValue);//输出原值
}
}
}
Ext.override(Ext.form.RadioGroup, {
getValue: function() {
var v;
if (this.rendered) {
this.items.each(function(item){
if (!item.getValue())
return true;
v = item.getRawValue();
return false;
});
}
else {
for (var k in this.items) {
if (this.items[k].checked) {
v = this.items[k].inputValue;
break;
}
}
}
return v;
},
setValue: function(v) {
if(this.rendered)
this.items.each(function(item) {
item.setValue(item.getRawValue() == v);
});
else
for(k in this.items) this.items[k].checked = this.items[k].inputValue == v;
}
});
把上述代码加到你的js文件的前面,
重写radioGroup的getValue(),setValue()方法就可以了
API中有个这样的事件:change : ( Ext.form.RadioGroup this, Ext.form.Radio checked ) ,
第二个参数应该就是你想要的值,
我现在没有ExtJs的环境,没法测试,你自己试下看行不