PDA

View Full Version : Combo : display valueField instead of displayField at the load



ludoIris
1 Dec 2009, 5:56 AM
Hello,

I have a problem with my comboBox.
In a form of update, I have a comboBox. It is initialized perfectly but it displays the valuefield instead of the displayfield at the loading of the page. And when I expand my combo, I see perfectly my displayed fields.

Can someone help me ?

Here is my source code :


{
id: 'nationality'
,xtype:'combo'
,inputType : 'text'
,allowBlank: false
,labelSeparator : ''
,fieldLabel: 'Nationality'
,name: 'nationality'
,readOnly: false
,typeAhead: true
,mode: 'remote'
,minChars : 1
,hiddenName: 'HIDDEN_nationality'
,triggerAction: 'all'
,emptyText:''
,selectOnFocus:true
,store: new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: '../../../../../imis/json/listCountry?request=prepare'
}),
autoLoad: true,
reader: new Ext.data.JsonReader({
totalProperty: 'bcObject.listSize',
root: 'bcObject.executionListData',
id: 'id'
},
[{name: 'id'}, {name: 'countryName'}]),
sortInfo:{field: 'countryName', direction: "ASC"}
})
,valueField:'id'
,displayField:'countryName'
}


Thanks you for advance.

Ludo

husniadil
1 Dec 2009, 1:45 PM
So, you wanna display displayField instead of valueField?

When the page loads, you should do both setValue and setRawValue.

example:

combo.setValue('62');
combo.setRawValue('Indonesia');