【问题标题】:Loop to reload data from each store in ExtJS Sencha循环从 ExtJS Sencha 中的每个商店重新加载数据
【发布时间】:2021-03-08 21:26:55
【问题描述】:

我有 3 个或更多商店(A、B、C),我想用传递的参数重新加载它们。我可以使用循环重新加载所有这些吗?

 onClickRefreshButton: function() {       
    Ext.getStore('A').reload({
        params: {
            FirstParameter: 123,
            SecondParameter:456,
            ThirdParameter: 789,
        }
  });

【问题讨论】:

    标签: for-loop extjs sencha-touch


    【解决方案1】:

    这里有一个可以满足你需要的小提琴:

    https://fiddle.sencha.com/#view/editor&fiddle/3cbh

    在我之前的解决方案中,我忘了指定范围:

     myArrayStores.forEach(st => { st.reload(); }, this); 
    

    【讨论】:

    • 不客气。如果答案有效,请将答案标记为正确答案。 :)
    【解决方案2】:

    当然。为什么不呢?

    myArrayStores.forEach(st => { st.reload(); });

    【讨论】:

    • 谢谢@Cesar,但我得到 TypeError: st.reload is not a function onClickRefreshButton: function() { var myArrayStores = ['A', 'B', 'C']; myArrayStores.forEach((st) => { st.reload({ params: { FirstParameter: 123, SecondParameter:456, ThirdParameter: 789, } }); });
    猜你喜欢
    • 1970-01-01
    • 2020-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-31
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多