Sencha touch Sencha Touch JSONP存储数据未显示在面板中
我已经将我的应用程序按我认为应该的方式连接起来,当我将其加载到Chrome中时,Javascript控制台不会抛出任何错误。WebService最终返回了适当的数据,但出于某种原因,我一直无法弄清楚为什么面板是空白的 以下是应用程序URLSencha touch Sencha Touch JSONP存储数据未显示在面板中,sencha-touch,jsonp,datastore,Sencha Touch,Jsonp,Datastore,我已经将我的应用程序按我认为应该的方式连接起来,当我将其加载到Chrome中时,Javascript控制台不会抛出任何错误。WebService最终返回了适当的数据,但出于某种原因,我一直无法弄清楚为什么面板是空白的 以下是应用程序URL 这是Web服务URL 下面是一些相关的代码 控制器 rpc.controllers.VimeoController = new Ext.Panel( rpc.views.Vimeo.index ); 查看 rpc.views.Vimeo.inde
这是Web服务URL
下面是一些相关的代码 控制器
rpc.controllers.VimeoController = new Ext.Panel(
rpc.views.Vimeo.index
);
查看
rpc.views.Vimeo.index = {
id: 'VideoView',
title: 'Videos',
tpl: rpc.templates.VimeoTemplate,
iconCls: 'tv',
dockedItems: [{ xtype: 'toolbar', title: 'Videos'}],
store: 'rpc.stores.VimeoStore'
};
商店
rpc.stores.VimeoStore = new Ext.data.Store({
id: 'VimeoStore',
model: 'rpc.models.VimeoModel',
proxy: {
type: 'scripttag',
url: WebService('Vimeo', 'Read'),
method: 'GET',
reader: {
type: 'json',
root: 'results'
}
},
autoLoad: true
});
rpc.templates.VimeoTemplate = new Ext.XTemplate([
'<tpl for=".">',
'<div>',
'{title}',
'</div>',
'</tpl>'
]);
型号
rpc.models.VimeoModel = Ext.regModel('rpc.models.VimeoModel', {
fields: [
{name: 'id', type: 'int'},
{name: 'title', type: 'string'}
]
});
模板
rpc.stores.VimeoStore = new Ext.data.Store({
id: 'VimeoStore',
model: 'rpc.models.VimeoModel',
proxy: {
type: 'scripttag',
url: WebService('Vimeo', 'Read'),
method: 'GET',
reader: {
type: 'json',
root: 'results'
}
},
autoLoad: true
});
rpc.templates.VimeoTemplate = new Ext.XTemplate([
'<tpl for=".">',
'<div>',
'{title}',
'</div>',
'</tpl>'
]);
rpc.templates.VimeoTemplate=new Ext.XTemplate([
'',
'',
“{title}”,
'',
''
]);
JSON响应
stcCallback1001({“结果”:[{“id”:25036464,标题:“《屈服生活的力量:告别布道》”},{“id”:25036610,标题:“《儿童奉献2011年6月》”},{“id”:24734142,标题:“《屈服生活的力量:联系》”},{“id”:24884833,标题:“《2011年6月金融更新》”},{“id”:24587711,标题:“:“巴布亚,印度尼西亚,2011年5月共享”},{“id”:24232427,“头衔”:“伊希瑟斯:未来的国王”},{“id”:23868560,“头衔”:“伊希瑟斯:疗愈者”},{“id”:23486615,“头衔”:“伊希瑟斯:圣洁者”},{“id”:23211649,“头衔”:“伊希瑟斯:救世主”},{“id”:23867961,“长老公告:布伦特·特拉斯克”},{“id”:22998163,“头衔”:“恩典的胜利:复活的主”},{“id”:23687914,“头衔”:“恩典的胜利:在位的国王”}{“id”:23692076,“头衔”:“现在的王国:因为王国是你的”},{“id”:23694183,“头衔”:“现在的王国:救我们脱离邪恶”}],“成功”:真实})
任何帮助或指导都将不胜感激。您提供的示例响应看起来像JSONP,而不是简单的JSON。您可能需要 要使用此功能,您可以将您的商店更改为如下所示:
rpc.stores.VimeoStore = new Ext.data.Store({
id: 'VimeoStore',
model: 'rpc.models.VimeoModel',
proxy: {
type: 'jsonp',
url: WebService('Vimeo', 'Read'),
reader: {
type: 'json',
root: 'results'
}
},
autoLoad: true
});
祝你好运!从视图中删除'
。这样写:
rpc.stores.VimeoStore = new Ext.data.Store({
id: 'VimeoStore',
model: 'rpc.models.VimeoModel',
proxy: {
type: 'jsonp',
url: WebService('Vimeo', 'Read'),
reader: {
type: 'json',
root: 'results'
}
},
autoLoad: true
});
存储:rpc.stores.VimeoStore
从1.1.0版开始,Ext.data.proxy.JsonP不在sencha touch中,只是在常规ExtIt中,它对已经存在的JsonP响应不起作用。我如何解决这个问题?它是否呈现了工具栏?并且您的存储id和面板的id属性不匹配,这可能会导致问题。您可以帮助我,您是如何解决的?