mercredi 11 février 2015

Select value dynamically of a combobox

Hello,

i have a combobox in a form. The combobox is attached to a store which holds some elements. The elements are pair of kind "id", "name".


Hence i defined my combobox in such way



Code:



xtype: 'combobox',
fieldLabel: 'Type of User',
name: 'typeOfUser',
editable: false,
displayField: 'name',
queryMode: 'local',
store: 'mylocalstore',
valueField: 'id',
valueNotFoundText: '',

At certain point i receive from the server a json message holdin which user should be automatically selected. The server sends me the "id" of the user to be selected.

That's good. what i do is

Code:



combobox.setValue(selecteduser)

But then what i see is different from what i'm expecting to see.

Suppose i have the record ("3","Foo");

Suppose the server says "id:3", then i see "3", instead of "Foo".


Is there a way to do it?

I searched online and on the forum, but i didn't understand if there is an answer.






Select value dynamically of a combobox

Aucun commentaire:

Enregistrer un commentaire