我已逐步遵循 Sencha 指南,但我似乎没有从我的服务器得到响应。我在控制台中没有收到任何错误,所以我有点难过。任何帮助都会很棒。
这是我认为的商店配置
store: {
fields: ['title', 'description', 'time', 'date', 'image', 'longdesc'],
proxy: {
type: 'jsonp',
url: 'http://mydomain.co.uk/scheduledata.json',
reader: {
type: 'json',
rootProperty: 'scheduleData'
}
}
},
itemTpl: '<div class="white-circle">{time}</div> <div class="list-title">{title}</div> <div class="list-desc">{description}</div><div class="arrow-right"></div>'
以及托管在我的服务器上的 JSON 文件。
{
"scheduleData" : [
{
"title" : "Event One",
"description" : "Meet and Greet",
"time" : "10:45",
"date" : "Friday",
"image" : "./resources/imageone.jpg",
"longdesc" : "This is a longer description"
},
{
"title" : "Event Two",
"description" : "Q and A",
"time" : "11:00",
"date" : "Friday",
"image" : "./resources/imagetwo.jpg",
"longdesc" : "This is a longer description still"
}
]
}
更新:这是带有配置的完整 JS 文件:
Ext.define('scheduleApp.view.Home', {
//extend: 'Ext.Panel',
//xtype: 'homepanel',
extend: 'Ext.navigation.View',
xtype: 'schedulepanel',
id: 'sched',
config: {
navigationBar: {
hidden: true
},
title: '<span class="logo"></span>',
items: [
{
xtype: 'container',
layout: 'vbox',
items: [
{
xtype: 'container',
flex: 2,
items: [
{
xtype: 'container',
layout: {
type: 'hbox'
},
items: [
{
html: '<img src="./resources/map.jpg" width="100%" height="100%"/>'
}
]
}
]
},
{
xtype: 'container',
flex: 5,
layout: {
type: 'fit'
},
items: [
{
xtype: 'list',
store: {
type: 'tree',
sorters: 'date',
fields: ['title', 'description', 'time', 'date', 'image', 'longdesc'],
proxy: {
type: 'jsonp',
url: 'http://www.mydomain.co.uk/scheduledata.json',
reader: {
type: 'json',
rootProperty: 'scheduleData'
}
}
},
itemTpl: '<div class="white-circle">{time}</div> <div class="list-title">{title}</div> <div class="list-desc">{description}</div><div class="arrow-right"></div>'
}
]
}
]
}
]
}
});