struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manu Mahajan <m...@comprointertech.com>
Subject Re: unable to capture events with <s:tree>
Date Mon, 02 Apr 2007 10:34:25 GMT
Thanks for the reply Dave, but this is not working for me. I have tried 
enabling debugging in dojo. Also tried the following method that I found 
in the dojo documentation, apart from trying to assign event handlers to 
individual tree nodes.

<script>
    var handlerNode = dojo.widget.byId("contentTree");
    dojo.event.connect(handlerNode, "onClick", "treeNodeSelected");
</script>

I don't get any errors but it just doesn't work.

Do I have to include a jar or some other files for enabling dojo related 
stuff in my web app? Right now I only have the jars that are included in 
struts2-blank.war

Dave Newton wrote:
> --- Manu Mahajan <manu@comprointertech.com> wrote:
>   
>> Do I have to use some dojo specific code here?
>>     
>
> I've been using the Dojo binding stuff; my sample is
> from a pretty long time ago now but here it is in case
> it helps. It might just make things worse ;)
>
> The Javascript:
>
> function treeNodeSelected(nodeId) {
>   alert("nodeId = " + nodeId);
>   /* Normally I'm doing some Ajax on a select; I left
>    * it here so you could see one way if you want.
>   dojo.io.bind({
>       url: "<s:url action='foo/bar'/>",
>       load: function(type, data, evt) {
>           var displayDiv = dojo.byId("displayId");
>           displayDiv.innerHTML = data;
>       },
>       mimeType: "text/html"
>   });
>   */
> };
>
> // arg1: topic named in <s:tree.../>
> // arg2: not sure; don't remember
> // arg3: name of JavaScript handler.
> dojo.event.topic.subscribe("treeSelected", this,
> "treeNodeSelected");
>
> The JSP:
>
> <s:tree theme="ajax"
>         rootNode="%{rootNode}"
>         childCollectionProperty="children"
>         nodeIdProperty="id"
>         nodeTitleProperty="name"
>         treeSelectedTopic="treeSelected"
>         toggle="explode"
>         toggleDuration="0"
>         cssClass="bptree"
>         id="bptree">
>
> I'll add this or something similar to the Wiki at some
> point, and I fixed the snippets that were giving an
> error.
>
> Question about snippets: is there a way to make them
> render properly?
>
> d.
>
>
>
>  
> ____________________________________________________________________________________
> It's here! Your new message!  
> Get new email alerts with the free Yahoo! Toolbar.
> http://tools.search.yahoo.com/toolbar/features/mail/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>   


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message