代码之家  ›  专栏  ›  技术社区  ›  Nuri Engin

Ext JS:如何重新加载多个存储?

  •  3
  • Nuri Engin  · 技术社区  · 7 年前

    我在里面定义了几个商店 ViewModel 我有一个按钮,可以将所有这些文件一起重新加载。而不是创建多个 var 协助 Ext.getStore('sampleStore') ,我只想用一个 风险值 和使用 reload() 只有一次。

    这是一个not 充分地 工作代码段;

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

    这里是定义在 视图模型 :

    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: {}
    
    1 回复  |  直到 6 年前
        1
  •  3
  •   jose    7 年前

    试试这样:

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