11 Apr 2008 3:24 AM #1
tree node selection
I have a tree panel. My goal is to get the node text on mouse click. I am using the following code:
var node=tree.getSelectionModel().getSelectedNode(); alert(node);
1. When I click on any node, it gives me the id of the previously selected node. I am not getting the name of the current clicked node, as I am invoking the code through listener on click event. I think at the point when I click on a node the previously clicked node still remains selected and before the selection changes to the newly clicked node, it takes the ID of the previous node and gives it to me. Any suggestions or way out would be a great help. Thank you.
11 Apr 2008 3:45 AM #2
Use Firefox with Firebug and start using the console.log feature instead of alert, it allows you to inspect anything passed even an object and its contents! Is extremely useful.
Try node.text, thats just off the top of my head though.
11 Apr 2008 3:53 AM #3
Thank you again as my required issue is solved.
11 Apr 2008 3:55 AM #4
Do a console.log on the variable node, whats its contents?
Lets also see the rest of your tree code wrapped in bbcode code brackets on the forum please. Thanks.
20 Feb 2011 2:57 AM #5
this might help you :