PDA

View Full Version : Tree 'selectionchange' event is not working



liotrox
4 Jan 2007, 6:23 AM
Hi,

I'm using a code like:



function initTree()
{
var Tree = YAHOO.ext.tree;

var tree = new Tree.TreePanel('treeContainer',
{
animate : true,
enableDD : false,
containerScroll: true,
loader: new Tree.TreeLoader({ dataUrl: LX.Ajax.pageMethodURL('getTreeNodes') })
});

// set the root node
var root = new Tree.AsyncTreeNode(
{
id : 'C:/',
text : 'C:/',
draggable: false
});
tree.setRootNode(root);


// render the tree
tree.render();

// false for not recursive (the default), false to disable animation
root.expand();

tree.getSelectionModel().on('selectionchange', showFileDetails, tree, true);
tree.getSelectionModel().select(root);
}

function showFileDetails(eventType, treePanel, node)
{
alert('node:' + node.id);
}


the function 'showFileDetails' is not getting called when tree selection change.

What's wrong in this example?

Thanks for your help.
Angelo

jack.slocum
5 Jan 2007, 9:20 AM
function showFileDetails(eventType, treePanel, node)
{
alert('node:' + node.id);
}

It's probably throwing an error silently. There is no eventName paramter so node is null.

function showFileDetails(treePanel, node)
{
alert('node:' + node.id);
}