wood burning stoves 2.0*
The moose likes Struts and the fly likes getting a selected node in a tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getting a selected node in a tree" Watch "getting a selected node in a tree" New topic
Author

getting a selected node in a tree

Rohit Rai
Ranch Hand

Joined: Aug 04, 2008
Posts: 53
Hi!
I have a sample tree created using the following code.

<s:tree theme="ajax" id="root" label="TestTracking" showGrid="true">
<s:treenode theme="ajax" id="child2" value="2" label="<b>Project 2</b>" />
<s:treenode theme="ajax" id="child3" value="3" label="<b>Project 3</b>" />
</s:tree>

Now on click of a node I would like to alert some message e.g.

<s:treenode theme="ajax" id="child2" value="2" onClick="alert('i am here')" label="<b>Project 2</b>" />

But it is not working. Am i doing something wrong?

Thanks for any help,
Regards
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Rohit Rai wrote:

Now on click of a node I would like to alert some message e.g.

<s:treenode theme="ajax" id="child2" value="2" onClick="alert('i am here')" label="<b>Project 2</b>" />

But it is not working. Am i doing something wrong?



Not used Struts 2, but I don't think there is an attribute "onClick()" , with C capital.. make it small, like "onclick(..)". For reference, I looked this.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

When interacting with Dojo controls it's probably best to use the Dojo event handlers; see the Dojo documentation for details (and recall that S2 is using a rather old version of Dojo, 0.4.x if I remember correctly).
 
wood burning stoves
 
subject: getting a selected node in a tree
 
Similar Threads
Problem in giving action on tree created using <s:tree> tag
Ajax tag is not working in strus2.1.6 with eclipse editor
How to use, struts 1-- struts-config.xml and struts 2 -- struts.xml together?
Linking a table to s:tree
Doubts In struts tree(tree attribute refers which tld file in struts)