You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manu Mahajan <ma...@comprointertech.com> on 2007/04/02 10:58:49 UTC

unable to capture events with

I am unable to capture any events with a dynamically created tree.

My jsp code is pasted below. The tree renders correctly. I have tried 
using tags like onclick, onchange etc but it doesnt seem to be working. 
Do I have to use some dojo specific code here?


<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<s:head theme="ajax"/>
<script type="text/javascript">
function nodeClicked(nodeID){
    alert('foo')
}
</script>
</head>
<body>
<s:tree id="categoryTree"
        theme = "ajax"
        rootNode="category"
        childCollectionProperty="categoryList"
        nodeIdProperty="id"
        nodeTitleProperty="name"
        onclick="nodeClicked"
       >
 </s:tree>
</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
For your information. The tree examples in the struts2 showcase app are 
also not working. I have tried on a fresh install of Tomcat. The trees 
render properly but nothing happens on clicking the nodes. As of now I 
don't have access to any other container so can only test on Tomcat.

Manu Mahajan wrote:
> I'm using Tomcat 5.5
>
> Tapio Holopainen wrote:
>> Hi,
>>
>> Which web container you are using? I have found problems when using 
>> dojo with Websphere.
>>
>> Regards,
>>
>> - Tapio
>>
>>
>> On Mon, 02 Apr 2007 13:34:25 +0300, Manu Mahajan 
>> <ma...@comprointertech.com> wrote:
>>
>>> 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 <ma...@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
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>> --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
I have posted a comment and the suggested patch on Jira.

I think this has probably broken due to a change in Dojo upstream.

Dave Newton wrote:
> --- Manu Mahajan <ma...@comprointertech.com> wrote:
>   
>> If your code is working then can you please check
>> what version of struts you are using because it's
>>     
> not
>   
>> working for me. I am using struts2-core-2.0.6.jar
>>     
>
> I'm using 2.0.6, fairly recently upgraded from 2.0.5.
>
> I tried it out again as a sanity check and, of course,
> it no longer works (and something *horrible* is
> happening on that page that makes Firefox lock up for
> like 3 minutes, but I was in the process of changing
> it so I must have left something in an awkward
> state...)
>
> So yes, I'd say there's a problem, although I'm not
> sure when it actually started. Nothing relating to the
> tree stuff (appears to have, anyway!) changed between
> 2.0.5-2.0.6; haven't checked 2.0.4 yet.
>
> I probably won't be able to look at it again until I
> resolve my rendering issue, but maybe someone else has
> some input.
>   
>> Please suggest if I'm on the right track and if this
>> could be incorporated in the struts code and what is
>>     
>
>   
>> the formal way to suggest this to the developers.
>>     
>
> File a JIRA ticket against <s:tree.../>.
>
> It looks as though this may have already been done:
>
> https://issues.apache.org/struts/browse/WW-1813
>
> so you could add a comment and attach your proposed
> patches.
>
> (I am curious as to when it broke, now; I would have
> sworn it worked under 2.0.5, but now I'm thinking
> maybe not since 2.0.4? I dunno.)
>
> d.
>
>
>
>  
> ____________________________________________________________________________________
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>   


Re: unable to capture events with

Posted by Dave Newton <ne...@yahoo.com>.
--- Manu Mahajan <ma...@comprointertech.com> wrote:
> If your code is working then can you please check
> what version of struts you are using because it's
not
> working for me. I am using struts2-core-2.0.6.jar

I'm using 2.0.6, fairly recently upgraded from 2.0.5.

I tried it out again as a sanity check and, of course,
it no longer works (and something *horrible* is
happening on that page that makes Firefox lock up for
like 3 minutes, but I was in the process of changing
it so I must have left something in an awkward
state...)

So yes, I'd say there's a problem, although I'm not
sure when it actually started. Nothing relating to the
tree stuff (appears to have, anyway!) changed between
2.0.5-2.0.6; haven't checked 2.0.4 yet.

I probably won't be able to look at it again until I
resolve my rendering issue, but maybe someone else has
some input.
> Please suggest if I'm on the right track and if this
> could be incorporated in the struts code and what is

> the formal way to suggest this to the developers.

File a JIRA ticket against <s:tree.../>.

It looks as though this may have already been done:

https://issues.apache.org/struts/browse/WW-1813

so you could add a comment and attach your proposed
patches.

(I am curious as to when it broke, now; I would have
sworn it worked under 2.0.5, but now I'm thinking
maybe not since 2.0.4? I dunno.)

d.



 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
Hi Dave,

If your code is working then can you please check what version of struts 
you are using because it's not working for me. I am using 
struts2-core-2.0.6.jar

I tried to investigate the problem a bit and here's the result of my effort.

I downloaded the dojo toolkit from the official website and went through 
some samples. Here is what I found

Code generated by struts2
<div dojoType="Tree"  id="contentTree" 
publishSelectionTopic="treeNodeSelected">

This is not working for me.

Code from Dojo sample
<dojo:TreeSelector widgetId="treeSelector" 
eventNames="select:nodeSelected"></dojo:TreeSelector>
<div dojoType="Tree" id="contentTree" selector="treeSelector">

This is working.

I think the <dojo:TreeSelector> is required for the tree to notify 
select events. and the selector parameter in the tree connects the tree 
and the selector.

Since the <s:tree> tag does not support the selector parameter I 
modified struts code to allow a parameter named "treeSelector" in this tag
I made changes to the following files in the struts-core jar
template/ajax/tree.ftl
org/apache/struts2/components/Tree.class
org/apache/struts2/views/jsp/ui/TreeTag.class
/META-INF/struts-tags.tld

The modified files are attached with the mail as a .zip file in case 
somebody else wants to use/review them.(I had to zip them because I 
thought it might be rude to send 400KB of attachments)

So my jsp now looks like

<s:head debug="true" theme="ajax"/>
<script language="JavaScript" type="text/javascript">
dojo.addOnLoad(function() {
        dojo.event.topic.subscribe("nodeSelected",
             function(message) { dojo.debug(message.node.title+" 
selected"); }
        );
    });
</script>

<dojo:TreeSelector widgetId="treeSelector" 
eventNames="select:nodeSelected"></dojo:TreeSelector>
<s:tree id="contentTree"
        name="contentTree"
        theme = "ajax"
        rootNode="%{category}"
        childCollectionProperty="categoryList"
        nodeIdProperty="ID"
        nodeTitleProperty="name"
        treeSelector="treeSelector">
</s:tree>

This is working perfectly for me but I think the solution would not be 
complete till we have a <s:treeSelector> tag in the tag lib.

Please suggest if I'm on the right track and if this could be 
incorporated in the struts code and what is the formal way to suggest 
this to the developers.

Regards
Manu  Mahajan




Dave Newton wrote:
> --- Manu Mahajan <ma...@comprointertech.com> wrote:
>   
>> I'm using Tomcat 5.5
>>     
>
> The code I posted is working for me; can you post your
> current code? (Personally I won't have access to my
> code until this evening, but maybe somebody else can
> help.)
>
> 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
>
>
>
>   


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
Yes, I've tried with those options. I'm not getting any debug output in 
this case.

Can anyone verify if the struts showcase app examples work. Because to 
me it seems that they don't either. Here's code from the sample app.

<!-- START SNIPPET: treeExampleDynamicJsp -->
 
 <script>
     function treeNodeSelected(nodeId) {
     alert(nodeId)//added by manu for testing
         dojo.io.bind({
             url: "<s:url 
value='/tags/ui/ajax/dynamicTreeSelectAction.action' />?nodeId="+nodeId,
             load: function(type, data, evt) {
                 var displayDiv = dojo.byId("displayId");
                 displayDiv.innerHTML = data;
             },
             mimeType: "text/html"
         });
     };
 
     dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");
 </script>

 
 <div style="float:left; margin-right: 50px;">
 <s:tree
     theme="ajax"
     rootNode="%{treeRootNode}"
     childCollectionProperty="children"
     nodeIdProperty="id"
     nodeTitleProperty="name"
     treeSelectedTopic="treeSelected">
 </s:tree>
 </div>
 
 <div id="displayId">
 Please click on any of the tree nodes.
 </div>
 
 <!-- END SNIPPET: treeExampleDynamicJsp -->
 
I have added the alert in the function. It never seems to get called.

Dave Newton wrote:
> --- Manu Mahajan <ma...@comprointertech.com> wrote:
>   
>>     function treeNodeSelected(){
>>         alert('Temporary like Achilles')
>>     }
>>     dojo.event.topic.subscribe("/treeSelected",
>> this, "treeNodeSelected");
>>
>> <s:tree id="contentTree"
>>         theme = "ajax"
>>         rootNode="%{category}"
>>         childCollectionProperty="categoryList"
>>         nodeIdProperty="id"
>>         nodeTitleProperty="name"
>>         toggle="expand"
>>         toggleDuration="0"
>>         treeSelectedTopic="/treeSelected"
>>         >
>>  </s:tree>
>>     
>
> I just don't see anything immediately wrong; the only
> differences are the arguments to the JavaScript
> function (did you try with a single argument like
> mine?) and the "/" in the topic, which definitely
> shouldn't matter (but try it anyway).
>
> You're getting no debug output?
>
>   
>> I have a feeling that I'm missing some dependancy.
>> Do i need anything apart from the jars in the blank 
>> app?
>>     
>
> I don't know, but I doubt it. Dojo is contained inside
> S2 (at least for 2.0.6; which version are you using
> again?)
>
> d.
>
>
>
>  
> ____________________________________________________________________________________
> TV dinner still cooling? 
> Check out "Tonight's Picks" on Yahoo! TV.
> http://tv.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>   


Re: unable to capture events with

Posted by Dave Newton <ne...@yahoo.com>.
--- Manu Mahajan <ma...@comprointertech.com> wrote:
>     function treeNodeSelected(){
>         alert('Temporary like Achilles')
>     }
>     dojo.event.topic.subscribe("/treeSelected",
> this, "treeNodeSelected");
>
> <s:tree id="contentTree"
>         theme = "ajax"
>         rootNode="%{category}"
>         childCollectionProperty="categoryList"
>         nodeIdProperty="id"
>         nodeTitleProperty="name"
>         toggle="expand"
>         toggleDuration="0"
>         treeSelectedTopic="/treeSelected"
>         >
>  </s:tree>

I just don't see anything immediately wrong; the only
differences are the arguments to the JavaScript
function (did you try with a single argument like
mine?) and the "/" in the topic, which definitely
shouldn't matter (but try it anyway).

You're getting no debug output?

> I have a feeling that I'm missing some dependancy.
> Do i need anything apart from the jars in the blank 
> app?

I don't know, but I doubt it. Dojo is contained inside
S2 (at least for 2.0.6; which version are you using
again?)

d.



 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
Here's my code.

<head>
<s:head debug="true" theme="ajax"/>
<script language="JavaScript" type="text/javascript">
    function treeNodeSelected(){
        alert('Temporary like Achilles')
    }
    dojo.event.topic.subscribe("/treeSelected", this, "treeNodeSelected");
</script>
</head>

<body>
<s:tree id="contentTree"
        theme = "ajax"
        rootNode="%{category}"
        childCollectionProperty="categoryList"
        nodeIdProperty="id"
        nodeTitleProperty="name"
        toggle="expand"
        toggleDuration="0"
        treeSelectedTopic="/treeSelected"
        >
 </s:tree>
<div id=dojoDebugOutput></div>
</body>
</html>

I have a feeling that I'm missing some dependancy. Do i need anything 
apart from the jars in the blank app?

Dave Newton wrote:
> --- Manu Mahajan <ma...@comprointertech.com> wrote:
>   
>> I'm using Tomcat 5.5
>>     
>
> The code I posted is working for me; can you post your
> current code? (Personally I won't have access to my
> code until this evening, but maybe somebody else can
> help.)
>
> 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
>
>
>
>   


Re: unable to capture events with

Posted by Dave Newton <ne...@yahoo.com>.
--- Manu Mahajan <ma...@comprointertech.com> wrote:
> I'm using Tomcat 5.5

The code I posted is working for me; can you post your
current code? (Personally I won't have access to my
code until this evening, but maybe somebody else can
help.)

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


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
I'm using Tomcat 5.5

Tapio Holopainen wrote:
> Hi,
>
> Which web container you are using? I have found problems when using 
> dojo with Websphere.
>
> Regards,
>
> - Tapio
>
>
> On Mon, 02 Apr 2007 13:34:25 +0300, Manu Mahajan 
> <ma...@comprointertech.com> wrote:
>
>> 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 <ma...@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
>>>
>>>
>>>
>>>
>>
>
>
>
> --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unable to capture events with

Posted by Tapio Holopainen <ta...@gmail.com>.
Hi,

Which web container you are using? I have found problems when using dojo  
with Websphere.

Regards,

- Tapio


On Mon, 02 Apr 2007 13:34:25 +0300, Manu Mahajan  
<ma...@comprointertech.com> wrote:

> 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 <ma...@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
>>
>>
>>
>>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unable to capture events with

Posted by Manu Mahajan <ma...@comprointertech.com>.
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 <ma...@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
>
>
>
>   


Re: unable to capture events with

Posted by Dave Newton <ne...@yahoo.com>.
--- Manu Mahajan <ma...@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