PDA

View Full Version : [FIXED-206][3.0+] radioGroup value config doesn't set the value, but setValue() works



qooleot
28 Aug 2009, 1:53 PM
B]Ext version tested:[/B]
Ext 3.0+ SVN rev 5146


Adapter used:
jquery


css used:
only default ext-all.css



Browser versions tested against:

FF3


Operating System:

Ubuntu


Description:
radioGroup value config does not set the value, but the setValue() works fine.


Test Case:



Ext.onReady(function(){

// Ext.QuickTips.init();
Ext.BLANK_IMAGE_URL = 'images/s.gif';
Ext.QuickTips.init();

var radiogroup = new Ext.form.RadioGroup({
renderTo: 'radio_holder',
fieldLabel: 'Sort by direction',
name: 'sort_1_dir',
id: 'first_radio',
value: 'asc',
items: [{
boxLabel: 'Ascending',
inputValue: 'asc',
id: 'asc'
},{
boxLabel: 'Descending',
inputValue: 'desc'
}]
})

});




which does not pre-check off 'Ascending', but doing:



Ext.getCmp('first_radio').setValue('asc');


in firebug after the page loads works fine

qooleot
28 Aug 2009, 1:54 PM
hrmm that didn't work well. I've been having all sorts of problems with the bulletin board in the last day or so...but I think its readable.

mjlecomte
30 Aug 2009, 5:11 AM
Maybe this falls more under documentation problem than bug, try this:


Ext.onReady(function(){

Ext.QuickTips.init();


// combine all that into one huge form
var fp = new Ext.FormPanel({
title: 'Check/Radio Groups Example',
frame: true,
labelWidth: 110,
width: 600,
renderTo: 'form-ct',
bodyStyle: 'padding:0 10px 0;',
items: [
new Ext.form.RadioGroup({
fieldLabel: 'Sort by direction',
name: 'sort_1_dir',
id: 'first_radio',
values: ['asc'],
items: [{
boxLabel: 'Ascending',
inputValue: 'asc',
id: 'asc'
}, {
boxLabel: 'Descending',
inputValue: 'desc'
}]
})
]
});
});

qooleot
30 Aug 2009, 6:18 AM
Ok tested and your suggestion works. It looks to be a documentation bug since 'values' is not listed as a config option but 'value' is. I'll post this to the documentation thread.

Tom23
30 Aug 2009, 10:03 AM
No. This is a double bug.

- RadioGroup.setValues() should be set to emptyFn. (values config option makes no sense)

- Ext.form.RadioGroup.initValue() needs to be re-implemented, since Ext.form.RadioGroup inherits from Ext.form.CheckboxGroup, and Ext.form.CheckboxGroup.initValue == emptyFn. (overwrites Ext.form.Field.initValue() which hence can't be inherited)

evant
30 Aug 2009, 7:32 PM
Fix applied to svn in rev #5241 for patch release 3.0.2.

Stefan B
1 Oct 2009, 4:16 AM
The fix in place does not fully comply with how fields work.
It does NOT set the originalValue for the individual radio controls, thus it breaks the isDirty() functionality when the initial value for a RadioGroup/CheckboxGroup is set via the value config parameter.

Is this a known limitation?
Any fixes/overrides available?

Thanks
Stefan