【问题标题】:Sencha Touch 2 Offline Caching with JsonP ProxySencha Touch 2 使用 JsonP 代理进行离线缓存
【发布时间】:2012-05-23 17:34:16
【问题描述】:

假设我已遵循 Sencha Touch 2 入门教程,并且有一个由 JsonP 代理数据填充的列表 - 如果用户离线,我该如何让缓存数据出现?目前,如果没有互联网连接,则根本不会显示该列表。

在视频教程中,Ed 简要提到这可以“轻松完成”,但没有提供我在 Sencha 文档中可以找到的参考。

以下是我的商店对象的示例:

Ext.define('test.store.NewsListStore', {
extend : 'Ext.data.Store',
requires: ['test.model.NewsListModel', 'Ext.data.Request'],
config : {
    model : 'test.model.NewsListModel',
    storeId : 'news-list-store',
    autoLoad: true,
    proxy: {
    type: 'jsonp',
    url : 'http://example.com/jsonp',
    config : {
        noCache: false
    }
   },
    grouper : {
        groupFn : function(record) {
            var unix_timestamp = parseInt(record.get("entry_date"));
            var date = new Date( unix_timestamp*1000 );
            return Ext.Date.format(date, 'F');
        }
    },
}
});

【问题讨论】:

    标签: list caching proxy jsonp extjs


    【解决方案1】:

    看看这个关于参加 Sencha Touch app offline 的教程 - 这不是 Sencha Touch 2,但它可能会为你指明正确的方向

    【讨论】:

      【解决方案2】:

      这是一个你可以使用 localstorage 的例子:

      http://www.robertkehoe.com/2012/11/sencha-touch-2-localstorage-example/

      它使用 Sencha Touch 2

      【讨论】:

        猜你喜欢
        • 2012-05-05
        • 2012-05-23
        • 2012-09-05
        • 2012-04-02
        • 1970-01-01
        • 2014-03-30
        • 2012-05-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多