Jo David
Jo David

Reputation: 1746

Sencha Touch 2.3 - store proxy does not load local json file

I'm really struggling to get my sencha touch application running.

It seems that sencha touch doesn't execute the request to the json file that I have defined inside of the store proxy.

If I switch the proxy for data the list is getting populated by the data. Chrome developer tools don't show any clues that sencha is even trying to get the json file.

The app is hosted by Microsoft IIS (json mime-type is properly configured).

Model:

Ext.define("ACS.model.Test", {
    extend: "Ext.data.Model",
    config: {
        fields: [ "name"]
    }
});

Store:

Ext.define("ACS.store.TestStore", {
    extend: "Ext.data.Store",

    config: {
        model: "ACS.model.Test",
        proxy: {
            autoLoad: true,
            type: "ajax",
            url: "test.json",

            reader: {
                type: "json",
                rootProperty: "test"
            },
        }

        /* data : [
            {name: "Test 1"},
            {name: "Test 2"}
        ]*/
    }
});

View:

Ext.define("ACS.view.TestView",{
    extend: "Ext.Panel",
    xtype: "test",
    requires: [
        "Ext.dataview.List"
    ],

    config: {
        title: "Test",
        iconCls: "team",
        layout: "fit",
        items:[
            {
                xtype: "titlebar",
                title: "Test",
                docked: "top"
            },
            {
                xtype: "list",
                store: "TestStore",
                itemTpl: "Name: {name}"
            }
        ]
    }
});

"test.json"

{
    "test" : [
        {"name" : "Name1"},
        {"name" : "Name2"},
        {"name" : "Name3"},
        {"name" : "Name4"}
    ]
}

Upvotes: 0

Views: 2706

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30092

autoLoad is a configuration on the store, not the proxy.

Upvotes: 3

Related Questions