Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-1238
in
a recent build.
-
Sencha Premium Member
[PR3] selectfield getValues issue
If the "value" config is passed to a selectfield, "getValue()" does not call the specified "getValue" function defined in Ext.field.Select (on line 49921 in sencha-touch-all-debug), but the optimizedGetter function (line 3285).
Maybe it's an even bigger problem for other fields or components, too.
Example:
Code:
var fieldset = new Ext.form.Panel({
items: [{
xtype: 'fieldset',
items: [{
xtype: 'selectfield',
store: [...],
value: 1 // this disturbs the config
}]
}]
});
-
Thank you for the report.
-
Sencha User
Is there a workaround to get the value? I'm getting the same issue with sliderfields in a fieldset.
-
Sencha User
Another error on getValues is that a toogle returns now an Array and not the given value.
-
Sencha User
I too can reproduce the problem. See below on a snippet of my code on how I "worked" around the problem on PR3. on PR2 it works fine. If I don't set a default value then getValue(), works fine. Its only then you set a value you get returned a object which you have to go into. Unless I'm doing this wrong and its working by chance 100% of the time :-)
Code:
{
xtype: 'selectfield',
name : 'carriercountry',
label: 'Country',
valueField : 'countryid',
displayField : 'countryname',
value: country_code,
store : CountriesStore,
listeners: {
change: function(newOption) {
apncountry = newOption.getValue().data.countryid; // PR3
//apncountry = newOption.getValue(); // PR2
CarriersStore.read({ params : {country:apncountry} });
}
}
},
-
Sencha User
I had the same issue with a sliderfield.
As a workaround, I set the value using the setValue function instead of setting it through the config.
I'm guessing the issue happens because of automatic getter and setter functions set on each config, but I'm not sure as I don't know how that works.
If that's indeed the case, it should be fairly easy to fix, by checking if a function already exists with the same name before creating the getter or setter.
-
This issue has been fixed for the next release.