PDA

View Full Version : Expand node does not fire callback



nothing
20 Nov 2012, 4:46 AM
I am testing my ExtJs App with Jasmine. So there is no views involved.

I want to expand several nodes, but first my root node. But even expanding that node fails.

I create my TreeStore, then:




var oRoot = oStore.getRootNode();
var oNode = oStore.getNodeById( 'root' );

// oNode.isExpanded() says false
// oNode.hasChildNodes() says false

oNode.expand(false, function(oChildren) {
// it never gets here
console.log( "hello?");
});



Why is that so? How can I get that node to expand?

nothing
21 Nov 2012, 5:40 AM
Found the solution. I need to wait for the store to get loaded. Is is a Jasmine issue:



runs( function() { oStore.on( 'load', function() { bStoreLoaded = true; }); });

waitsFor( function() { return bStoreLoaded; }, " store to be loaded", 5000 );

runs( function() { oNode.expand(false, function( aoChildren ) { aoChildrenRoot = aoChildren; bRootExpanded = true; }); });