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

My list view layout is similar to Pinterest, with absolutely positioned blocks.Unfortunately, this see

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

}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745304066a4621606.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信