【问题标题】:How to consume web services in Sencha Touch 2.2如何在 Sencha Touch 2.2 中使用 Web 服务
【发布时间】:2013-09-04 10:51:18
【问题描述】:

我是 Sencha Touch 的新手。我尝试使用 Web 服务,但它一直说“无法使用提供的配置加载数据。在浏览器中打开”。我的店铺是

Ext.define('MyApp.store.MyJsonPStore', {
    extend: 'Ext.data.Store',

    requires: [
        'MyApp.model.MyModel'
    ],

    config: {
        autoLoad: true,
        model: 'MyApp.model.MyModel',
        storeId: 'MyJsonPStore',
        proxy: {
            type: 'jsonp',
            url: 'http://api.twitter.com/1/statuses/public_timeline.json',
            reader: {
                type: 'json',
                rootProperty: 'errors'
            }
        }
    }
});

我的模型是

Ext.define('MyApp.model.MyModel', {
    extend: 'Ext.data.Model',

    config: {
        fields: [
            {
                name: 'message'
            },
            {
                name: 'code'
            }
        ]
    }
});

提前感谢您的帮助。

【问题讨论】:

标签: extjs sencha-touch jsonp extjs-mvc sencha-architect


【解决方案1】:

Ext.define('MyApp.store.MyJsonPStore', { 扩展:'Ext.data.Store',

requires: [
    'MyApp.model.MyModel'
],

config: {
    autoLoad: true,
    model: 'MyApp.model.MyModel',
    storeId: 'MyJsonPStore',
    proxy: {
        type: 'jsonp',
        /*url: 'http://api.twitter.com/1/statuses/public_timeline.json',*/Url not valid
        reader: {
            type: 'json',
            rootProperty: 'errors'
        }
    }
}

});

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-05-13
  • 1970-01-01
  • 2012-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-17
相关资源
最近更新 更多