RadioGroup补丁(无法获取选中radio的值)

下面是重写RadioGroup的代码:

Ext.override(Ext.form.RadioGroup, {

getValue: function() {

   var v;

this.items.each(function(item) {

   if ( item.getValue() ) {

    v = item.getRawValue();

return false;

}

});

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;
}
});


下面是我的radioGroup代码:

{
xtype : 'radiogroup',
id:'incomeStatType_query',
name : 'groupType',
width:200,
fieldLabel : '统计方式',
items : [{
boxLabel : '按网站',
name : 'groupType',//必须要有name属性否则各项不互斥
inputValue : 'site_id',
checked : true
}, {
boxLabel : '按代码位',
name : 'groupType',
inputValue : 'adgroup_id'
}]
}

获得radiogroup值的方法:
1、Ext.getCmp("incomeStatType_query").getValue()
2、var groupType = queryPanel.find("name","groupType")[0].getValue();

你可能感兴趣的:(java,ext)