View Full Version : how to set a boolean value to a radiogroup
xunxin
6 Apr 2012, 12:54 AM
i call the loadRecord method of the form which contains a radiogroup(male and female),but the radio in the radiogroup don't checked by the loaded value.
anyone can help me? thanks in advance.
xunxin
6 Apr 2012, 12:57 AM
{ fieldLabel: 'gendar',
xtype: 'radiogroup',
allowBlank: false,
defaults: {
flex: 1,
name : 'gendar'
},
layout: 'hbox',
items: [
{
boxLabel: 'male',
inputValue: 'true',
checked: true
},
{
boxLabel: 'female',
inputValue:'false'
}
]
}
xunxin
6 Apr 2012, 5:47 PM
i read the document many times, but have no idea how to set it.
anyone can help me?
xunxin
6 Apr 2012, 8:03 PM
i solved it by override the setValue method of RadioGroup.
i think it is bug. the override code is following:
Ext.define('my.form.RadioGroup',{ override : 'Ext.form.RadioGroup',
setValue: function(value) {
var me = this,name=me.name,wrapValue={};
if(!Ext.isObject(value)){//the value will not be a object if it loaded from a form
wrapValue[name]=value;
value = wrapValue;
}
return me.callParent(arguments);
}
});
the config
{ fieldLabel: 'gendar',
xtype: 'radiogroup',
allowBlank: false,
name : 'gendar',// it is neccessary
defaults: {
flex: 1,
name : 'gendar' // it is neccessary
},
layout: 'hbox',
items: [
{
boxLabel: 'male',
inputValue: true,
checked: true
},
{
boxLabel: 'female',
inputValue: false
}
]}
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.