javascript - 我如何在点击 'refresh' 时完全重新加载我的 Sencha Touch 应用程序?

标签 javascript extjs sencha-touch sencha-touch-2

我的 ListView 布局类似于 Pinterest,具有绝对定位 block 。 不幸的是,这似乎需要在刷新时完全重新初始化。 如果仅重新加载商店(如下所示),则新 block 的位置不正确。

当用户点击刷新时如何重新加载应用程序?

这是我的观点:

Ext.require(['Ext.data.Store', 'MyApp.model.StreamModel'], function() {
    Ext.define('MyApp.view.HomeView', {
        extend: 'Ext.navigation.View',
        xtype:  'homepanel',

        requires: [
            'Ext.dataview.List',
        ],

        config: {
            title:            'Home',
            iconCls:          'home',
            styleHtmlContent: true,
            navigationBar: {
                items: [
                    {
                        xtype:    'button',
                        iconMask: true,
                        iconCls:  'refresh',
                        align:    'left',
                        action:   'refreshButton'
                    }
                ]
            },
            items: {
                title: 'My',
                xtype: 'list',
                itemTpl: [
                    '<div class="post">',
                        ...
                    '</div>'

                ].join(''),

                store: new Ext.data.Store({
                    model: 'MyApp.model.StreamModel',
                    autoLoad: true,
                    storeId: 'stream'
                }),
            }
        }
    });
});

型号:

Ext.define('MyApp.model.StreamModel', {
    extend: 'Ext.data.Model',
    config: {
        fields: [
            'post_id',
            'comments'
        ],
        proxy: {
            type: 'jsonp',
            url:  'http://My.com/app',
            reader: {
                type: 'json',
            }
        }
    }
});

和我的 Controller :

Ext.define('MyApp.controller.RefreshController', {
    extend: 'Ext.app.Controller',
    requires: [
        'Ext.navigation.View'
    ],
    config: {
        control: {
            'button[action=refreshButton]': {
                tap: 'refresh'
            }
        }
    },
    refresh: function() {
        // Ext.StoreMgr.get('stream').load();

        // here I'd like to reload the app instead
        // not just the store
    }
});

最佳答案

refresh: function() {
    // Ext.StoreMgr.get('stream').load();

    // here I'd like to reload the app instead
    // not just the store
    window.location.reload();

}

关于javascript - 我如何在点击 'refresh' 时完全重新加载我的 Sencha Touch 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12756281/

相关文章:

javascript .split() 采用未定义的值

javascript - Phonegap/Cordova 推送通知不唤醒屏幕

ios - 适用于 iPad 的单页 Web 应用程序?

javascript - sencha 触摸过滤器商店列表?

javascript - sencha touch 动态构建表单面板

javascript - Sencha Touch SelectField 问题

javascript - 为 IE 优化 jQuery

javascript - jQuery - 点击类 - 获取其他类

javascript - 服务器使用 Grails 发送事件

javascript - Sencha Touch Checkbox 选择标签点击