【发布时间】: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