【问题标题】:Sencha Touch 2.3 - store proxy does not load local json fileSencha Touch 2.3 - 存储代理不加载本地json文件
【发布时间】:2013-10-21 11:12:57
【问题描述】:

我真的很难让我的 sencha touch 应用程序运行。

似乎 sencha touch 没有执行对我在 store 代理中定义的 json 文件的请求。

如果我将proxy 切换为data,则列表将被数据填充。 Chrome 开发者工具没有显示 sencha 甚至试图获取 json 文件的任何线索。

应用由 Microsoft IIS 托管(json mime-type 已正确配置)。

型号:

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

商店:

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"}
        ]*/
    }
});

查看:

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"}
    ]
}

【问题讨论】:

    标签: json extjs sencha-touch


    【解决方案1】:

    autoLoad 是商店的配置,不是代理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 2012-07-24
      • 1970-01-01
      • 2012-06-12
      • 2012-04-27
      相关资源
      最近更新 更多