PDA

View Full Version : [2.0] TreePanel expand event is called "expandexpandnode"



Carina
12 Jul 2007, 11:41 PM
hi,

just a small thing...
I want to listen to the node expand event of a TreePanel. "expand" and "expandnode" don't work. Instead I have to listen for "expandexpandnode" - is this intended?

Example:

Tree = Ext.tree;
var tree = new Tree.TreePanel("test", {
animate:true,
enableDD:true,
containerScroll: true,
rootVisible:false
});
var root = new Tree.TreeNode({
text: 'Albums',
allowDrag:false,
allowDrop:false
});
tree.setRootNode(root);

root.appendChild(
new Tree.TreeNode({text:'Album 1', cls:'album-node', allowDrag:false}),
new Tree.TreeNode({text:'Album 2', cls:'album-node', allowDrag:false}),
new Tree.TreeNode({text:'Album 3', cls:'album-node', allowDrag:false})
);

tree.render();
root.expand();

tree.on('expandexpandnode', function() {
alert("expandexpandnode fired (1)!");
}, tree);


tree.on('expandnode', function() {
alert("expandnode fired (2)!");
}, tree);

tree.on('expand', function() {
alert("expand fired (3)!");
}, tree);

results in:
alert("expandexpandnode fired (1)!");

Browser: Firefox on Mac,
Ext 2.0, rev. 702, YUI adapter
(sorry if this has already been fixed in SVN, I don't update more than once a week).

jack.slocum
13 Jul 2007, 3:09 AM
No, this is a silly bug by me, thanks for reporting!

The culprit, if you just want to edit your file until I check in is in TreePanel.fireEvent:

ename += ename+'node';

should be

ename = ename+'node';

Thanks again!