Sencha Touch JSONP存储数据未显示在面板中 [英] Sencha Touch JSONP Store Data not showing up in Panel

查看:123
本文介绍了Sencha Touch JSONP存储数据未显示在面板中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有应用程序按照我认为的方式连接,并且在将其加载到Chrome中时,Javascript控制台不会引发任何错误. WebService最终返回了适当的数据,但是由于某种原因,我无法终生弄清楚面板为何空白.

I've got my sencha-touch app wired up as I believe it should be, and when I load it into Chrome, the Javascript console doesn't throw any errors. The WebService is finally returning the appropriate data, yet for some reason I can't for the life of me figure out why the panel is blank.

这是APP URL
http://rpcm.infinitas.ws/

Here's the APP URL
http://rpcm.infinitas.ws/

这是WebService URL
http://rpc.infinitas.ws/Vimeo/Read ?_dc = 1308083451839& limit = 25& callback = stcCallback1001

Here's the WebService URL
http://rpc.infinitas.ws/Vimeo/Read?_dc=1308083451839&limit=25&callback=stcCallback1001

这是一些相关代码.

CONTROLLER

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:" 6月儿童奉献2011},{" id:24734142," title:"投降的力量:连接"},{"id":24884833,"title":"2011年6月财务更新"},{"id": 24587711,"title":印度尼西亚,巴布亚,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," title: 长者公告:Brent Trask"},{"id":22998163,"title":恩典的胜利:崛起的领主"},{"id":23687914,"title":恩典的胜利:统治国王" },{"id":23692076,"title":现在的王国:因为你的王国是你的",{" id:23694183," title:"现在的王国:从邪恶中拯救我们}],"成功:true});

stcCallback1001({"results":[{"id":25036464,"title":"Power of A Surrendered Life: The Farewell Sermon"},{"id":25036610,"title":"Child Dedication June 2011"},{"id":24734142,"title":"Power of A Surrendered Life: Connection"},{"id":24884833,"title":"Finance Update June 2011"},{"id":24587711,"title":"Papua, Indonesia Sharing May 2011"},{"id":24232427,"title":"ICHTHUS: Coming King"},{"id":23868560,"title":"ICHTHUS: Healer"},{"id":23486615,"title":"ICHTHUS: Sanctifier"},{"id":23211649,"title":"ICHTHUS: Saviour"},{"id":23867961,"title":"Elder Announcement re: Brent Trask"},{"id":22998163,"title":"Triumph of Grace: Risen Lord"},{"id":23687914,"title":"Triumph of Grace: Reigning King"},{"id":23692076,"title":"KINGDOM now: For Thine Is The Kingdom"},{"id":23694183,"title":"KINGDOM now: Deliver Us From Evil"}],"success":true});

任何帮助或指导将不胜感激.

Any help or direction will be greatly appreciated.

推荐答案

您提供的示例响应看起来像JSONP而不是纯JSON.您可能需要 Ext.data.proxy .JsonP .

The example response you provided looks like JSONP instead of plain JSON. You probably want an Ext.data.proxy.JsonP.

要使用此功能,您可以将商店更改为以下形式:

To use this, you could change your store to look like this:

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
});

祝你好运!

这篇关于Sencha Touch JSONP存储数据未显示在面板中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆