1

I have the following JSON, receiving it from backend:

{
    "scripts": [
        "actions/rss",
        "actions/db/initDb",
        "actions/utils/MyFile",
        "actions/utils/Valid"
    ],
    "success": true
}

JSON store:

    this.store = new Ext.data.JsonStore({

        proxy: new Ext.data.HttpProxy({
            url: "http://www.example.com",
            method: 'POST'
        }),
        baseParams: {
            appId: "hsvdvndcnwvwbasxcwyc"               
        },
        root: 'scripts',
        fields: ['value']

    });

Combobox:

    this.aField = new Ext.form.ComboBox({
        fieldLabel      : 'action',
        name        : 'actionName',
        anchor      : "95%",                     
        allowBlank      : false,
        emptyText       : "Select action",            

    triggerAction   : 'all',
    lazyRender      : true,
    mode            : 'remote',
        store           : this.store,
    valueField      : 'value',
    displayField    : 'value'
    });     

So, I am receiving response from backend, it's ok. But my combobox dropdown list is empty (it shows 10 empty lines which are equal to number of items in JSON). I know that the ploblem is in fields property of JSON Store. But what should I put in there to get it work?

Thanks!

1
  • I use ExtJS 3.4. If it matters. Commented Jan 24, 2013 at 10:28

1 Answer 1

1

Try modifying "JSON store:" code with putting root: 'scripts', in side reader object and add type too and add reader in proxy.

So JSON store: code should look like below

this.store = new Ext.data.JsonStore({
   proxy: new Ext.data.HttpProxy({
        url: "http://www.example.com",
        method: 'POST',
        reader: {            
                  type:'json',
                  root: 'scripts'
        }
    }),
    baseParams: {
        appId: "hsvdvndcnwvwbasxcwyc"               
    },

    fields: ['value']
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! But I've solved the problem by replacing JSONStore with ArrayStore. So data is loaded to the store via ajax request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.