下面是重写RadioGroup的代码:
下面是我的radioGroup代码:
{
xtype : 'radiogroup',
id:'incomeStatType_query',
name : 'groupType',
width:200,
fieldLabel : '统计方式',
items : [{
boxLabel : '按网站',
[color=red]name : 'groupType',//必须要有name属性否则各项不互斥[/color]
inputValue : 'site_id',
checked : true
}, {
boxLabel : '按代码位',
name : 'groupType',
inputValue : 'adgroup_id'
}]
}
获得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 : '按网站',
[color=red]name : 'groupType',//必须要有name属性否则各项不互斥[/color]
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();