【发布时间】:2011-03-17 08:37:08
【问题描述】:
我对应该做的简单事情感到困惑,但无法让它发挥作用。我尝试了来自不同站点的几个示例,并查看了 Sencha Touch API,但没有运气。我正在尝试从外部 JSON 源填充列表。为了让它尽可能简单,我现在只是把它放在一个外部文件中。
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady : function() {
Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});
var store = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName')[0];
},
proxy: {
type: 'ajax',
url : 'test.json',
reader: {
type: 'json'
}
}
});
var list = new Ext.List({
fullscreen: true,
itemTpl : '{firstName} {lastName}',
store: store
});
list.show();}});
JSON 文件
[
{
"firstName" : "pelle",
"lastName": "ollesson"
},
{
"firstName" : "nisse",
"lastName": "pellssdfok"
}
]
有什么你可以立即看到的错误吗?
提前致谢
【问题讨论】:
标签: json sencha-touch