继checkBoxGroup之后的radioGroup取值和赋值问题

1、radioGroup取值

如图为RradioGroup
代码如下:
{
xtype: 'radiogroup',
// width: 170,
text: '审核',
id:'verifyResult',
x: 255,
y: 695,
items: [
{
xtype: 'radiofield',
boxLabel: '同意',
id:'verifyResultYes',
checked:true,
inputValue:'true',
name:'auditResult'
},
{
xtype: 'radiofield',
boxLabel: '不同意',
id:'verifyResultNo',
inputValue:'false',
name:'auditResult'
}
]
},
其中inputValue可以根据需要设置
verifyResult = Ext.getCmp("verifyResult").getChecked()[0].inputValue;
因为radioGroup为单选框,所以在执行getChecked()方法后我们只需要取其中的数组的第一个元素即可获得radioGroup的inputValue
2、赋值
我们假设后台传递的是radioGroup的inputValue值,那么我们可以采取如下的赋值方法
其中auditResult为RadioGroup的name值。
var value = inputValue
Ext.getCmp("verifyResult").setValue({
auditResult: [value]
});
这样即可以给radiogroup赋值!

你可能感兴趣的:(继checkBoxGroup之后的radioGroup取值和赋值问题)