PDA

View Full Version : Async TreePanel 'expand', 'collapse' events don't work



wickedsheep
7 May 2010, 12:32 AM
Hi guys,

I don't know if it's a bug, but when I add an 'expand' or 'collapse' listener to any TreePanel nothing happens - it works fine with 'click' or 'checkchange'. Anyone else has the same problem or am I doing something wrong?

Sample code:


TreeLoaderUi = Ext.extend(Ext.tree.TreePanel, {

// default config
width : 600,
height : 150,
autoScroll : true,
animate : true,
enableDD : true,
useArrows : true,
id : 'tree_loader',
dataUrl : '/en/ajax/data/platforms/',

// node
root: {
id : 'root_node',
nodeType : 'async',
text : 'Root name',
draggable : false
},

// listeners
listeners: {

'checkchange': function( node, checked ) {
alert( 'Check / Uncheck' );
},

'click': function( node, event ) {
alert( 'Click' );
},

'expand': function( node ) {
alert( 'Expand' );
},

'collapse': function( node ) {
alert( 'Collapse' );
}

},

// consturctor
initComponent: function() {

TreeLoaderUi.superclass.initComponent.call( this );

}

});


Thank you.

Animal
7 May 2010, 12:35 AM
expand : ( Ext.Panel p )
Fires after the Panel has been expanded.


Do you see any other events in the API docs for TreePanel which might be fired when a node is expanded?

MiamiCoder
7 May 2010, 11:38 AM
Try the expandnode and collapsenode events.

Maxrunner
10 May 2010, 6:19 AM
Im trying to expand and check a specific node and its children, but i cant check only expand.....the expandChildren method doesnt do anything too.

dredd
23 Jul 2010, 2:45 PM
I had a related problem, and found that some of my Child Nodes had the same ID as those above. This meant Ext didn't know what do when the child nodes (including Collapse/Expand) were click. Make sure that all your nodes have unique ID's as a starter.