问题描述
|
我已经按照我的想法将sencha-touch应用程序连接好了,当我将其加载到Chrome中时,Javascript控制台不会引发任何错误。 WebService最终返回了适当的数据,但是由于某种原因,我无法终生弄清面板为何空白。
这是APP网址
http://rpcm.infinitas.ws/
这是WebService URL
http://rpc.infinitas.ws/Vimeo/Read?_dc=1308083451839&limit=25&callback=stcCallback1001
这是一些相关的代码。
控制器
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.models.VimeoModel = Ext.regModel(\'rpc.models.VimeoModel\',{
fields: [
{name: \'id\',type: \'int\'},{name: \'title\',type: \'string\'}
]
});
模板
rpc.templates.VimeoTemplate = new Ext.XTemplate([
\'<tpl for=\".\">\',\'<div>\',\'{title}\',\'</div>\',\'</tpl>\'
]);
JSON响应
stcCallback1001({\“ results \”:[{\“ id \”:25036464,\“ title \”:\“投降的力量:告别布道\”},{\“ id \”:25036610,\ “ title \”:\“儿童奉献2011年6月\”},{\“ id \”:24734142,\“ title \”:\“投降的力量:连接\”},{\“ id \”: 24884833,\“ title \”:\“财务更新2011年6月\”},{\“ id \”:24587711,\“标题\”:\“印度尼西亚巴布亚,2011年5月共享\”},{\“ id \ “:24232427,\” title \“:\” ICHTHUS:Coming King \“},{\” id \“:23868560,\” title \“:\” ICHTHUS:Healer \“},{\” id \“ :23486615,\“ title \”:\“ ICHTHUS:Sanctifier \”},{\“ id \”:23211649,\“ title \”:\“ ICHTHUS:Saviour \”},{\“ id \”:23867961 ,\“标题\”:\“长辈公告:Brent Trask \”},{\“ id \”:22998163,\“标题\”:\“恩典的胜利:复活领主\”},{\“ id \“:23687914,\” title \“:\”恩典的胜利:统治之王\“},{\” id \“:23692076,\” title \“:\”现在的王国:献给您的是王国\“ },{\“ id \”:23694183,\“标题\”:\“现在的王国:从邪恶中拯救我们\”}],\“成功\”:true});
任何帮助或指示将不胜感激。
解决方法
您提供的示例响应看起来像JSONP而不是纯JSON。您可能需要一个Ext.data.proxy.JsonP。
要使用此功能,您可以将商店更改为如下形式:
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
});
祝您好运!
, 从视图中删除ѭ6。
像这样写:
商店:rpc.stores.VimeoStore