我对这个项目的目标是装载,用一个脚本输出的Web服务器上的Json,这样我可以在煎茶触摸在列表中显示的数据2.在煎茶触摸商店使用代理2
我我查看了无数的例子,包括来自其他人在这个网站上提出的问题的答案,我仍然无法弄清楚我的代码出现了什么问题。我相信这是一件非常小的事情,或者是我不了解的一些规则,但我希望有人能指出我正确的方向。
这里是我的模型:
Ext.define('Sencha.model.Location', {
extend: 'Ext.data.Model',
config: {
fields: ['name','location','open','details']
}
});
这里是我的商店:
Ext.define('Sencha.store.Locations',{
extend: 'Ext.data.Store',
requires:[
'Sencha.model.Location',
],
config: {
model: 'Sencha.model.Location',
storeId: 'Locations',
proxy: {
type: 'ajax',
url : 'http://url/to/locations.php?filetype=.json',
reader: {
type: 'json',
},
autoLoad: 'true'
}
}
});
这里就是我希望它显示出来的观点:
Ext.define('Sencha.view.LocationList',{
extend: 'Ext.List',
alias: 'widget.LocationList',
xtype: 'locationlist',
config: {
title: 'What\'s Open @CU',
disableSelection: true,
itemTpl: '<img src="http://localhost/{open}.png" style="width:16px;height:16px;margin-right:8px;" />{name}<span style="font-size:9pt;margin-left:8px;color:#888;">{location}</span>',
store: 'Locations',
onItemDisclosure: true
}
});
这里是一个的输出的JSON(也许这是一个格式问题,导致它默默地失败?)
{
"businesses":
{
"name" : "Baker's"
"location" : "4th Floor Uni Centre"
"open" : "open"
"details" : "This is some information."
}
}
在控制台中的任何错误? –
“http://url/to/locations.php”在同一个域中吗?没有CORS问题? – ThinkFloyd