PDA

View Full Version : Combobox not set the good value on load but blank



vdaudigny
6 Jun 2013, 7:29 PM
Hello,

I have a combobox and when i load it with particular value (not empty/default) it rendered blank.

I think it's because property name and valueField are differents ? and you ?

THX


{
xtype: 'combobox',
anchor: '100%',
fieldLabel: 'Organisme',
name: 'idOrganismePriseEnCharge',
displayField: 'Organisme',
store: 'Organismes',
valueField: 'idOrganisme'
}

Farish
6 Jun 2013, 10:59 PM
Just calling load on the combobox will not set the value also. after load, you have to set a value yourself by using setValue() method or if you know the value before hand (e.g. initial value), then you can use the value config in the combobox:


{
xtype: 'combobox',
store: store_combo,
valueField: 'fieldX',
displayField: 'fieldY',
value: 10 // value should be the valueField type (int or string)
}

it will work even if valueField and displayField are different.


store_combo.on('load', function() {
combo.setValue(10);
})

vdaudigny
9 Jun 2013, 11:54 AM
Thanx,

In my project, the others combo load the values correctly .. i don't understant !:-?

slemmon
10 Jun 2013, 10:49 AM
Can you post an example of a combobox where you're loading its store and it is doing what you're wanting - setting the value just by loading the store?