extJS RadioGroup setValue()函数

extJS RadioGroup setValue()函数,extjs,radio-group,setvalue,Extjs,Radio Group,Setvalue,我已经使用代码创建了RadioGroup var radios = new Ext.form.RadioGroup({ columns : 2, items: [ {boxLabel: 'E-Mail', name: 'communication', inputValue: 1}, {boxLabel: 'Nagios', name: 'communication', inputValue: 2}

我已经使用代码创建了RadioGroup

var radios = new Ext.form.RadioGroup({
     columns    : 2,
       items: [
             {boxLabel: 'E-Mail', name: 'communication', inputValue: 1},
             {boxLabel: 'Nagios', name: 'communication', inputValue: 2}
        ]
   });
我想查看某个事件的单选按钮之一。怎么做? 我尝试使用:

radios.setValue(true, false);

但它不起作用

radios.items.items应返回单选组中的单选按钮。然后可以对它们使用setValue()函数来选中或取消选中它们

radios.items.items[index].setValue(true/false);

尝试将值数组传递给setValue方法,如下所示:

radios.setValue([true, false]);
这将在ExtJS3.x中起作用不确定ExtJs4检查。

这对我来说很有效

radios.setValue({communication:<input value>});
radios.setValue({communication:});
其中输入值可以是单选按钮的inputValue字段的值


干杯

选择“电子邮件”,例如

radios.setValue({communication: 1});
一般用途:

radioGroup_var.setValue({radioGroup_name: 'inputValue'});


这是一个老线程,但谷歌总是先找到它,所以我将把我的解决方案(在ext3.4.1.1上)放在这里

试试这个:

var radios = new Ext.form.RadioGroup({
    columns: 2,
    name: 'communication', // <== ADD THE NAME AGAIN ON HERE
    items: [
        {boxLabel: 'E-Mail', name: 'communication', inputValue: 1},
        {boxLabel: 'Nagios', name: 'communication', inputValue: 2}
    ]
});
var radios=新的Ext.form.RadioGroup({
栏目:2,

名称:'communication',//但是我们如何使用RadioGroup的setValue()?这对单个组有效,但对整个组又如何呢
var radios = new Ext.form.RadioGroup({
    columns: 2,
    name: 'communication', // <== ADD THE NAME AGAIN ON HERE
    items: [
        {boxLabel: 'E-Mail', name: 'communication', inputValue: 1},
        {boxLabel: 'Nagios', name: 'communication', inputValue: 2}
    ]
});