【问题标题】:Ext JS: How to reload multiple stores?Ext JS:如何重新加载多个商店?
【发布时间】:2018-09-15 14:14:11
【问题描述】:

我在ViewModel 中定义了几个商店,并且我有一个按钮可以重新加载所有这些商店。我不想创建多个var 来与Ext.getStore('sampleStore') 关联,而是只想用一个var 选择所有,并且只使用一次reload()

这是一个不完全工作的sn-p;

refreshPanel: function () {   
        // This way only one of stores is reloading, its sampleStore1.
        var panelStores = Ext.getStore('sampleStore1', 'sampleStore2', 'sampleStore3');

        panelStores.reload();
    } 

这里是ViewModel中定义的商店:

stores: {
        // I've tried to give a storeId name but ofcourse did not work!
        //storeId: 'adminbonus',

        sampleStore1: {
            storeId: 'sampleStore1',
            ...
        },

        sampleStore2: {
            storeId: 'sampleStore2',
            ...
        },

        sampleStore3: {
            storeId: 'sampleStore3',
            ...
        },
    },

//And using several formulas with chainedstore or bindTo configs
formulas: {}

【问题讨论】:

    标签: javascript extjs store reload


    【解决方案1】:

    试试这样的:

        var panelStores = ['sampleStore1', 'sampleStore2', 'sampleStore3'];
    
        Ext.each(panelStores, function(eachStore) {
             var store = Ext.getStore(eachStore);
                if(store){
                    store.reload();
                }
        }
    

    【讨论】:

    • 完美运行。非常感谢!
    猜你喜欢
    • 2012-12-02
    • 1970-01-01
    • 1970-01-01
    • 2015-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-03
    • 2013-08-16
    相关资源
    最近更新 更多