View Full Version : [4.1 b2] TreeLoading - Concurrency Problem + Late Loading

28 Jan 2012, 4:12 AM
With loading the tree data from the back end I face two issues

The TreeStore.load function is not concurrency save.
How to separate the View initialization from the TreeLoading is not at all obvious.

To illustrate this problem I have deployed a simple example to http://enpasos.com/testTreeLoad/

The left side has a naive call of the load function that shows both problems (to see the concurrency issue you need to click the panel's reload button rapidly).

The right side shows the workaround that I use until the load function is bulletproof:

loadTreeWorkaround: function() {
var store = this.getTreeS_FixedStore();
var root = store.getRootNode();
if (root.isExpanded()) {
if (!store.isLoading())
} else {
root.set('expanded', false);

In my opinion the concurrency issue - that is not new - needs to get high attention!

1 Feb 2012, 11:39 AM
Any idea?

3 Feb 2012, 1:25 PM
I'm not entirely sure I understand what you are attempting to do, but are you aware that load and expand have callbacks that you can use? That way you will know when they have finished.

this.store.load({node: node, callback: function(records, operation, success) {

The second parameter of "expand" on a node is the callback function (not shown in the above example), as well. Just thought I'd post this in case it helps resolve what seem like timing issues.

6 Feb 2012, 12:05 PM
The only thing that I want to do is to allow users to call
store.load() often. In my opinion such a central function offered by the ExtJS framework should allow subsequent calls without ending in a inconsistent state. It should not be the tasks of the developer who calls the function to prohibit inconsistent states.