在我的形式radiogroup看起来像这样
{
xtype: 'radiogroup',
vertical: false,
fieldLabel: ' ',
labelSeparator: ' ',
reference: 'radiofield',
val: 1,
items: [
{
boxLabel: 'Complete',
name: 'complete[20]',
inputValue: '1'
},
{
boxLabel: 'Incomplete',
name: 'complete[20]',
inputValue: '2'
}
]
}, {
xtype: 'radiogroup',
vertical: false,
fieldLabel: ' ',
labelSeparator: ' ',
reference: 'radiofield',
val: 2,
items: [
{
boxLabel: 'Complete',
name: 'complete[19]',
inputValue: '1'
},
{
boxLabel: 'Incomplete',
name: 'complete[19]',
inputValue: '2'
}
]
},
并且在Load方法中,我正在设置像这样的值
Ext.each(ids, function(id){
var g = mainPanel.down('radiogroup[val='+id+']');
var name = 'complete['+id+']';
g.setValue({name: 2});//the value can be either 1 or 2
});
如何设置radiogroup的值 请注意,当我给他们像这样的硬编码值
g.setValue({'complete[19]': 2});
它有效,任何解决方案
答案 0 :(得分:0)
试试这个:
Ext.each(ids, function(id){
var g = mainPanel.down('radiogroup[val='+id+']');
var name = 'complete['+id+']',
var value = {};
value[name] = 2;
g.setValue(value);
});