最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I fully reload my Sencha Touch App when tapping 'refresh'? - Stack Overflow

programmeradmin1浏览0评论

My list view layout is similar to Pinterest, with absolutely positioned blocks. Unfortunately, this seems to require a full re-initialization at refresh. If reload only the store (as below) the new blocks are incorrectly positioned.

How do I reload the app when the user clicks on refresh?

This is my View:

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

Model:

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

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

My list view layout is similar to Pinterest, with absolutely positioned blocks. Unfortunately, this seems to require a full re-initialization at refresh. If reload only the store (as below) the new blocks are incorrectly positioned.

How do I reload the app when the user clicks on refresh?

This is my View:

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

Model:

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

and my 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
    }
});
Share Improve this question edited Feb 11, 2014 at 1:12 Evan Trimboli 30.1k5 gold badges48 silver badges67 bronze badges asked Oct 6, 2012 at 2:52 pepepepe 9,90925 gold badges117 silver badges192 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6
refresh: function() {
    // Ext.StoreMgr.get('stream').load();

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

}
发布评论

评论列表(0)

  1. 暂无评论