I have a combobox on a form where I need to reset its store along with the 'displayField' and 'valueField' configs.
Resetting the store via cmb.bindStore(newStore)
works great.
Setting cmb.displayField = 'newfieldname';
also works great.
However, cmb.valueField = 'newValField';
does not work. The combo displays the right stuff, but when i select an item, the value is using the old valueField value, not the new one.
I've tried:
- doing a
cmb.reset()
afterwards Ext.apply(...)
Is it because valueField
is somehow special because it is a required field? Is there some special way to set a config value on an Ext-JS component I don't know about or is it just not possible to change the value of 'valueField'?
FYI - Here is my code:
comp.bindStore(Ext.create('Ext.data.Store', {
fields : [ {
name : 'abbr',
type : 'string'
}, {
name : 'name',
type : 'string'
}, {
name : 'slogan',
type : 'string'
} ],
data : [ {
"abbr" : "AL",
"name" : "Alabama",
"slogan" : "The Heart of Dixie"
}, {
"abbr" : "AK",
"name" : "Alaska",
"slogan" : "The Land of the Midnight Sun"
}, {
"abbr" : "AZ",
"name" : "Arizona",
"slogan" : "The Grand Canyon State"
}, {
"abbr" : "AR",
"name" : "Arkansas",
"slogan" : "The Natural State"
}, ]
}));
comp.displayField = 'abbr'; // THIS WORKS
comp.valueField = 'abbr'; // THIS DOESNT WORK
getValue
? I ran your code with the Ext example with the valueField of 'name' andgetValue
worked. – plleevalueField
anddisplayField
being'name'
first? If I do that, and then change valueField and displayField to be 'abbr' the pull down lists shows abbreviations, but when you select one, the name of the state ends up being displayed in the combo box. I'll try to find time to make a jsfiddle. – HDavetpl
anddisplayTpl
and it worked. – pllee