Results 1 to 2 of 2

Thread: Combo value from an object

  1. #1
    Sencha User
    Join Date
    Jan 2014
    Posts
    22
    Answers
    1

    Default Combo value from an object

    Hi,

    I am facing an issue in displaying the value within a combo,
    The response that i receive from the server is as follows.
    Code:
    "{"versionId":0,"id":6,"addressText":"Test","country":{"id":1,"value":"India"},"parentCountryRegion":{"id":1,"value":"Maharashtra"},
    "countryRegion":{"id":3,"value":"Pune"},"city":{"id":1,"value":"Junnar"},"cellCountryCode":"+91"}

    From the above response, I have to display the value "India" into the dropdown but am unable to do it.

    The code for the Dropdown is as follows

    Code:
    {xtype : 'combobox',
    fieldLabel : 'Country :',
    name : 'country',
    itemId : 'countryId',
    emptyText : 'Select Country',
    store:'organization.CountryStore',
    valueField : 'id',
    displayField : 'countryName',}

  2. #2
    Sencha Premium User
    Join Date
    Mar 2011
    Posts
    287
    Answers
    35

    Default

    Assuming combobox is in a formPanel, you could try:

    Code:
    var formPanel = //get a handle on the form panel
    formPanel.getForm().setValues({
        countryId : 1
    });
    // Where 1 is pulled from the response you posted.

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
  •