PDA

View Full Version : Tree & Custom action



alessandro
23 Apr 2008, 6:09 AM
Hi all
i've got a piece of code like this


node.appendChild(this.createNode({
text: c.tagName,
xmlNode: c,
//leaf: ((c.childNodes.length + c.attributes.length) == 0) // usa questa se vuoi considerare gli attributi come dei nodi
leaf: ((c.childNodes.length) == 0),
href: (url != "") ? url : "#",
hrefTarget: "_blank",
}));


Instead using "href" pointing to "url" i need to execute a custom function when clicking on the leaf node.

How can I do?

I need to pass 'url' as parameter to my custom function.

Thanks.

mabello
23 Apr 2008, 9:01 AM
you can try to use the listeners property in your node definition

Hope this helps

NoahK17
23 Apr 2008, 9:19 AM
Yes. Using the listener allows you to monitor click events, mouseover, mouseout, etc.

alessandro
23 Apr 2008, 1:45 PM
Can you post an example code?
I'm not an expert and I don't know where to start...

Animal
23 Apr 2008, 1:51 PM
http://extjs.com/learn/Ext_2_Overview

http://extjs.com/learn/Manual:Intro:Event_Handling

http://extjs.com/deploy/dev/docs/?class=Ext.tree.TreePanel&member=click

alessandro
24 Apr 2008, 12:20 AM
Thanks!
I've solved by adding "on(click)" events in "createNode"