Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8719133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:43:06+00:00 2026-06-13T06:43:06+00:00

I am getting a json array string as response from a page. I want

  • 0

I am getting a json array string as response from a page. I want to bind it with a combobox.

This is the success block which gives me the json array string:

The json array string looks like this:

messagebox displaying the json array string

Please let me know hoe to bind this with the combobox drop down.

Regards,

EDIT:

This is the latest code I tried:

Ext.define('Country',{
extend: 'Ext.data.Model',
fields: [
    { name: 'id', type: 'string' },
    { name: 'name', type: 'string' }
]
});

Ext.define('CountryCombo', {
extend: 'Ext.form.field.ComboBox',
alias: 'widget.countrycombo',
allowBlank: false,
queryMode: 'local',
valueField: 'id',
displayField: 'name',
store: {
    model: 'Country',
    data: [
        { id: 'China', name: 'China'},
        { id: 'Japan', name: 'Japan'},
        { id: 'Malaysia', name: 'Malaysia'}
    ]
},
listeners: {
    "select": function(obj){  
        Ext.Ajax.request({
            url: '/CellEditing/FormServlet',
            method: 'POST',
            params: {
                data: obj.getValue()
            },
            success: function(obj){
                alert('success');
                alert(obj.responseText);
                console.log(StateCombo.storeStates); //This is undefined hence getting error
                StateCombo.storeStates.loadData(obj.responseText);
            },
            failure: function(obj){
                alert('failure');
            }
        });                 
    }
}
});

var storeStates = Ext.create('Ext.data.Store', {
autoLoad: false,
fields: ['State']
});

Ext.define('State',{
extend: 'Ext.data.Model',
fields: [
    { name: 'id', type: 'int' },
    { name: 'name', type: 'string' }
]
});

Ext.define('StateCombo', {
extend: 'Ext.form.field.ComboBox',
alias: 'widget.statecombo',
queryMode: 'local',
valueField: 'State',
displayField: 'State',
store: storeStates
});

This is the latest I tried but still when I select something from 1st combobox, the second combobox is not getting populated. any Help on this please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:43:07+00:00Added an answer on June 13, 2026 at 6:43 am

    Technically this code will work:

    http://jsfiddle.net/sdt6585/wPzPD/29/

    Ext.define('Country',{
        extend: 'Ext.data.Model',
        fields: [
            { name: 'id', type: 'string' },
            { name: 'name', type: 'string' }
        ]
    });
    
    Ext.define('CountryCombo', {
        extend: 'Ext.form.field.ComboBox',
        alias: 'widget.countrycombo',
        allowBlank: false,
        queryMode: 'local',
        valueField: 'id',
        displayField: 'name',
        store: {
            model: 'Country',
            data: [
                { id: 'China', name: 'China'},
                { id: 'Japan', name: 'Japan'},
                { id: 'Malaysia', name: 'Malaysia'}
            ]
        },
        listeners: {
            "select": function(obj){
                Ext.Ajax.request({
                    url: '/CellEditing/FormServlet',
                    method: 'POST',
                    params: {
                        data: obj.getValue()
                    },
                    callback: function (response, operation) {
                        //This should be the text string in reponseText, just putting it there since I don't have it
                        response.responseText = '{data: [{state: "State One"}, {state: "State Two"}, {state: "State Three"}]}'
                        //Put this in your success function
                        var data = Ext.JSON.decode(response.responseText).data;
                        storeStates.loadData(data);
                    }
                });
            }
        }
    });
    
    var storeStates = Ext.create('Ext.data.Store', {
        autoLoad: false,
        fields: ['state']
    });
    
    Ext.define('State',{
        extend: 'Ext.data.Model',
        fields: [
            { name: 'id', type: 'int' },
            { name: 'name', type: 'string' }
        ]
    });
    
    Ext.define('StateCombo', {
        extend: 'Ext.form.field.ComboBox',
        alias: 'widget.statecombo',
        queryMode: 'local',
        valueField: 'state',
        displayField: 'state',
        store: storeStates
    });
    
    Ext.form.Panel.create({
        title: 'Tester',
        renderTo: Ext.getBody(),
        items: [
            CountryCombo.create(),
            StateCombo.create()
        ]
    });​
    

    The major changes are these:

    • You need to decode the json string you got back with Ext.JSON.decode(response.responseText)) in the success function of your ajax call
    • You defined a state model, but the state store didn’t use it. It can be removed.
    • You had the state variable capitalized everywhere except in your json string. Corrected it to lower case.
    • Your reference to state combo was only to the template class for that view, not to an instance of it. In addition, if it were an initialized class, it’s store property is defined as such and has nothing to do with your variable name. You can either store a reference to the created combo box and call it’s store properties loadData function, or like I did, just use the storeStates reference to the store to load the data.

    While that technically works, it’s not the most elegant solution. You would be working with much more maintainable code to follow this process.

    1. Define Models for Country and State (ideally not in the global namespace!!) and give the state store a proxy to automatically decode the json responses.
    2. Define stores that use the models as their base
    3. Define views for your combo boxes (only if they will be reused elsewhere)
    4. Put instances of the combo boxes in a container of some sort (use either Ext.create() or the create() function of your view classes.
    5. Attach a listener to the instance of the country combo that you have created and have it call the load function of stateCombo’s store.

    Ext.define('MyApp.models.Country',{
        extend: 'Ext.data.Model',
        requires: ['Ext.data.SequentialIdGenerator'],
        idgen: 'sequential',
        fields: [
            { name: 'name', type: 'string' }
        ]
    });
    
    Ext.define('MyApp.stores.Country', {
        model: 'MyApp.models.Country',
        data: [
            { name: 'China'},
            { name: 'Japan'},
            { name: 'Malaysia'}
        ]
    });
    
    Ext.define('MyApp.models.State',{
        extend: 'Ext.data.Model',
        requires: ['Ext.data.SequentialIdGenerator'],
        idgen: 'sequential',
        fields: [
            { name: 'state', type: 'string' }
        ],
        proxy: {
            type: 'ajax',
            method: 'post',
            url: '/CellEditing/FormServlet',
            reader: {
                type: 'json',
                root: 'data',
                successProperty: false
            }
        }
    });
    
    Ext.define('MyApp.stores.State', {
        model: MyApp.models.State
    });
    
    Ext.define('MyApp.views.CountryCombo', {
        extend: 'Ext.form.field.ComboBox',
        alias: 'widget.countrycombo',
        allowBlank: false,
        queryMode: 'local',
        valueField: 'name',
        displayField: 'name',
        store: MyApp.stores.Country.create()
    });
    
    Ext.define('MyApp.views.StateCombo', {
        extend: 'Ext.form.field.ComboBox',
        alias: 'widget.statecombo',
        queryMode: 'local',
        valueField: 'state',
        displayField: 'state',
        store: MyApp.stores.State.create()
    });
    
    Ext.form.Panel.create({
        title: 'Tester',
        renderTo: Ext.getBody(),
        items: [
            countryCombo = MyApp.views.CountryCombo.create(),
            stateCombo = MyApp.views.StateCombo.create()
        ]
    });
    
    countryCombo.on('beforeselect', function (combo, record, index, eOpts) {
        stateCombo.store.load({
            params: {data: record.get('name')}
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting JSON string from website. I have data which looks like this
I have this json string by getting a response from using singleton client(RestKit). [
I am getting json response from this google api service to get reverse geo
I am getting JSON response from the server..Inside that JSON string i am having
I'm getting this json string info from the server : {members:[[sd2840d,Johny],[jkld341,Marry]]} So I store
I'm struggling getting the JSON string that was sent from a web page to
I am getting response from server side in the form of json array.I need
I am getting a JSON response back from a server and the array I
Hi friends i'm getting json from server (using kohana framework 3.0) like this.... {
I am getting json response like this {item_id:1,item_title:Item 1}{item_id:2,item_title:Item 2} how would I parse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.