简体   繁体   中英

Loop to reload data from each store in ExtJS Sencha

I have 3 or more stores (A,B,C) which I want to reload with passed parameters. Can I use a loop to reload all of them?

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

Of course. Why not?

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

Here you have a fiddle that does what you need:

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

In my previous solution, I forgot to specify the scope:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM