Sencha touch 数据未通过JSONP Sencha Touch 2加载到列表中
我已经一步一步地遵循了Sencha指南,但我似乎没有从我的服务器得到响应。我没有在控制台中得到任何错误,所以我有点困惑。任何帮助都将是惊人的 这是我视图中的存储配置Sencha touch 数据未通过JSONP Sencha Touch 2加载到列表中,sencha-touch,sencha-touch-2,Sencha Touch,Sencha Touch 2,我已经一步一步地遵循了Sencha指南,但我似乎没有从我的服务器得到响应。我没有在控制台中得到任何错误,所以我有点困惑。任何帮助都将是惊人的 这是我视图中的存储配置 store: { fields: ['title', 'description', 'time', 'date', 'image', 'longdesc'], proxy: { type: 'jsonp', url: 'http://mydomain.co.uk/scheduledata.json',
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>'
更新:以下是完整的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>'
}
]
}
]
}
]
}
Ext.define('scheduleApp.view.Home'{
//扩展:“Ext.Panel”,
//xtype:“homepanel”,
扩展:“Ext.navigation.View”,
xtype:“schedulepanel”,
id:'sched',
配置:{
导航栏:{
隐藏:真的
},
标题:“”,
项目:[
{
xtype:'容器',
布局:“vbox”,
项目:[
{
xtype:'容器',
弹性:2,
项目:[
{
xtype:'容器',
布局:{
类型:“hbox”
},
项目:[
{
html:'
}
]
}
]
},
{
xtype:'容器',
弹性:5,
布局:{
类型:“适合”
},
项目:[
{
xtype:'列表',
商店:{
键入:“树”,
分拣员:“日期”,
字段:['title','description','time','date','image','longdesc'],
代理:{
键入:“jsonp”,
网址:'http://www.mydomain.co.uk/scheduledata.json',
读者:{
键入:“json”,
rootProperty:“scheduleData”
}
}
},
itemTpl:“{time}{title}{description}”
}
]
}
]
}
]
}
})) 是否尝试将存储设置为自动加载:true?使用Chrome/Firefox开发控制台检查网络页面。您应该会在那里看到对JSON文件的请求。您能发布完整的
list
code吗?@SachinG抱歉,Sachin我很困惑。这是所有的列表代码,除了xtype@user1694888对我的意思是用xtype
发布代码,以及它的配置细节。正如第一条评论中所建议的,查看chrome中的“网络”选项卡以查看数据是否正确加载。@SachinG我查看了网络,但json文件似乎没有出现,因此出现了一个错误。现在将更新我的问题以包含完整代码。
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>'
}
]
}
]
}
]
}