Results 1 to 3 of 3

Thread: Select value dynamically of a combobox

  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2012
    Posts
    44

    Default 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.

  2. #2
    Sencha Premium Member
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791

    Default

    It sounds like you're doing this correctly to me.

    Perhaps it's a type mismatch? Is the 3 a string in one case and a number in the other?

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2012
    Posts
    44

    Default

    That's right.
    It was passed as a string.

    thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •