1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    39
    Vote Rating
    0
    cdiscla is on a distinguished road

      0  

    Default How to set value for a combobox bound to a store?

    How to set value for a combobox bound to a store?


    Hello
    i have a combobox that contains the list of my app's user declared as follows:

    xtype:'combobox',
    fieldLabel: 'Username',
    name: 'id_user',
    displayField:'name',
    valueField:'id_user',
    store: UsersStore

    I display the username and send the id to the database; the problem is that i don't know how to set the value when selecting from the db. If i do
    myForm.getForm().findField("id_user").setValue(record.data.id_user);

    I see the id and can't see the correct displayName ... how can i assign the pair id/name to the combo so that it displays the name and sends the id?
    Thanks in advance !

  2. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    setValue should work. If it can't find the value in the store it will just show it in the combobox. Double check that the value you are setting is present in the field id_user in one of the records in your store. Make sure it's a perfect match, including case-sensitivity and data-type (string, number, etc.).

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar