0

When I load my TreeStore a second time before the first load is finished, it fails. TreeStore load() doesn't seem to be reentrant.

So that is what I am doing to make the second load() wait:

    loadStore: function(){

      var store=this.store;

      if (store.isLoading()) this.addListener({
        load: function(store,rec,success){
            this.loadStore()
        },
        single: true
      });
      else store.load();

    },

The problem is that there is a window for a race condition between the time I check for isLoading() and the time I call load().

What is the proper way to load a TreeStore in ExtJS, knowing that it can be reloaded later ?

kmp
  • 10,535
  • 11
  • 75
  • 125
Gummy
  • 3
  • 2

1 Answers1

0

Javascript is, for the most part, single-threaded, so there shouldn't be any way to have the store load in between those checks, so I think you are okay. Ext's code makes these kinds of checks in their own source code, so it is probably safe.

I like to read this question's responses every once in awhile for a refresher on javascript threading.

Community
  • 1
  • 1
Sean Adkinson
  • 8,425
  • 3
  • 45
  • 64
  • Thanks, I didn't know javascript was single threaded ! No problem then :) Some more info on synchronous events here: http://javascript.info/tutorial/events-and-timing-depth – Gummy Nov 07 '11 at 05:43