<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>radio auto add items</title>
<meta name="Copyright" content="test"/>
<meta name="Description" content="PM"/>
<meta name="Version" content="0.0.1.20130621"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="../../../pm/css/ext-all-neptune-debug.css"/>
<link rel="stylesheet" href="../../../pm/css/ext-cn.css"/>
<script type="text/javascript" src="../../../../commons/extjs/script/ext-all.js"></script>
<script type="text/javascript" src="../../../../commons/extjs/script/ext-lang-zh_CN.js"></script>
<style type="text/css">
.x-form-radio {
position: absolute;
}
.x-form-cb-label-after {
margin: 5px 0px 0px 10px;
margin-left: 25px;
width: 250px;
}
.x-form-cb-wrap {
height: 24px;
width: 300px;
}
</style>
</head>
<body>
</body>
</html>
var equRadio=Ext.create('Ext.form.RadioGroup',{
id:'equRadio',
hideLabel : true,
// vertical: true,
Horizontal:true,
layout:'vbox',
items:[
/* { boxLabel: 'Item 1',id:'sbmcid',name: 'sbmc', inputValue: '1' },
{ boxLabel: 'Item 2',id:'sbmcid',name: 'sbmc', inputValue: '2', checked: true},
{ boxLabel: 'Item 3',id:'sbmcid',name: 'sbmc', inputValue: '3' }*/
]
});
var westPanel=Ext.create('Ext.panel.Panel',{
id:'westPanel',
layout:'vbox',
width:'30%',
/*frame:true,
border:false,
baseCls: 'my-panel-no-border',*/
region:'west',
items:[equRadio]
});
var equSiteRadio=Ext.create('Ext.form.RadioGroup',{
id:'equSiteRadio',
hideLabel : true,
layout:'vbox',
items:[]
});
var centerPanel=Ext.create('Ext.panel.Panel',{
id:'centerPanel',
layout:'vbox',
width:'30%',
region:'center',
/*frame:true,
border:false,
baseCls: 'my-panel-no-border',*/
items:[equSiteRadio]
});
Ext.data.StoreManager.lookup('sbmcStore').on('load', function (store, records) {
// Ext.getCmp("sbmc").select(Ext.data.StoreManager.lookup('sbmcStore').getAt(0));
// Ext.getCmp("mainequsite").setText("主设备位置:"+Ext.data.StoreManager.lookup('sbmcStore').data.items[0].get("V_EQUSITENAME"));
if(records.length>0){
var redios=[];
for(var i=0;i<records.length;i++){
if(i==0){
Ext.ComponentManager.get("equRadio").add({
checked : true,
boxLabel : records[0].get("V_EQUNAME"),
name : "sbmc",
// width:'300',
// labelWidth:'280',
inputValue : records[0].get("V_EQUCODE")
});
Ext.ComponentManager.get("equSiteRadio").add({
checked : true,
boxLabel : records[0].get("V_EQUSITENAME"),
name : "sbmc",
// width:'300',
// labelWidth:'280',
inputValue : records[0].get("V_EQUSITE")
});
}else{
Ext.ComponentManager.get("equRadio").add({
boxLabel : records[i].get("V_EQUNAME"),
name : "sbmc",
inputValue : records[i].get("V_EQUCODE")
});
Ext.ComponentManager.get("equSiteRadio").add({
boxLabel : records[i].get("V_EQUSITENAME"),
name : "sbmc",
inputValue : records[i].get("V_EQUSITE")
});
}
}
}
/* Ext.ComponentManager.get("equRadio").add({
checked : true,
id:'sbmcid',
boxLabel : '1',//records.data[0].get("V_EQUNAME"),
name : "sbmc",
inputValue :'10'//records.data[0].get("V_EQUCODE")
});*/
Ext.data.StoreManager.lookup('childEquStore').load({
params: {
V_V_PERSONCODE: V_V_PERSONCODE,
V_V_DEPTCODE: Ext.getCmp('ck').getValue(),
V_V_DEPTNEXTCODE: Ext.getCmp('zyq').getValue(),
V_V_EQUTYPECODE: Ext.getCmp('sblx').getValue(),
V_V_EQUCODE: Ext.getCmp('equRadio').getChecked().inputValue
}
});
// Ext.ComponentManager.get("westPanel").items.add({});
// Ext.getCmp('cpanel').show();
// Ext.getCmp('sgrid').getView().refresh()
});
![](https://i-blog.csdnimg.cn/blog_migrate/77366a1440da6a1fb9b7c87628e431cf.png)