Search code examples
for-loopextjssencha-touch

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,
        }
  });

Solution

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