Ale4224
Ale4224

Reputation: 11

Extjs 3.4 combobox with jsonStore not showing values

I'm trying to create a combobox with a jsonStore very simple. Here is my code

cboshortCode= new Ext.form.ComboBox({       
    fieldLabel:' - Short Code',
    name:'shortCode',
    id:'shortCode',
    width : 220,
    disableKeyFilter: true,
    store: new Ext.data.JsonStore({
        storeId: 'shortCodeStore',
        proxy: new Ext.data.HttpProxy({
            url: new Fiche().base_url + "/ricercaShortCode.do",
            method: 'GET'
            reader: {            
                type:'json',
                root: 'codes'
            }
        }),
        baseParams: {
            action: "getShortCode"
        },
        fields: ['code']
    }),
    valueField: 'code',
    displayField: 'code'
});

the call is made correctly, I can see from the console that I get this json as response:

{"codes": [
    {"code": "prova1"},
    {"code": "prova2"},
    {"code": "prova3"},
    {"code": "prova4"},
    {"code": "prova11"},
    {"code": "prova22"},
    {"code": "prova33"},
    {"code": "prova44"}
]}

But when I type "prova" nothing is showing (it show only the loading circle until the http call is returned).

What am I doing wrong?

Thanks

Upvotes: 0

Views: 75

Answers (1)

Ale4224
Ale4224

Reputation: 11

All right, I solved it simply using a simpler version of the store like this:

            store: new Ext.data.JsonStore({
                url: new Fiche().base_url + "/ricercaShortCode.do",
                root: "codes",
                baseParams: {
                    action: "getShortCode"
                },
                fields: ['code']
            }),

Upvotes: 1

Related Questions