You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Session A Mwamufiya <sm...@andrew.cmu.edu> on 2007/08/04 09:56:54 UTC

Gettin the selected item in a s:tree

Hi,

I was able to get the selected item from a s:select element, which can be accessed from the property variable that is associated with it.  Now I'm trying to do the same with the s:tree element.  But it seems as though there is no property object association with s:tree.  How would I go about getting a user's tree node selection from code?

Thanks,
Session


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


Re: Gettin the selected item in a s:tree

Posted by Toni Lyytikäinen <to...@gmail.com>.
YUI has great documentation, there are also nice examples at:

http://developer.yahoo.com/yui/treeview/


On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
>
> Do you have an example, because I know nothing about YUI.
>
> Also, I saw in the link you provided that there is a workaround for dojo,
> but I can't even check it out because I downloaded dojo and followed the
> HelloWorld tutorial, but it doesn't work.  I don't know what files/jars to
> include in my project for the dojo code to work.
>
> Could you send me an example of the workaround you used?
>
> Thanks,
> Session
>
>
> > I'm under the impression that the selected topic publishing isn't
> > currently working in Struts 2. At least the examples in the showcase app
> > aren't working for me (in Firefox 2.0.0.6). When I had to do something
> > similar I found this:
> >
> http://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.pl
> > ugin.system.issuetabpanels:all-tabpanel
> >
> > It says that it's fixed in 2.1.0, but since that isn't released yet, I
> > just decided to implement the tree using YUI and writing all the
> > javascript parts manually (it isn't very hard anyway).
> >
> > On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
> >>
> >> Hi again,
> >>
> >> Anyone has a clue about obtaining a user's selection in an s:tree
> >> element?  I used the example from the showcase, and I don't fully
> >> understand the following script:
> >>
> >> <script> function treeNodeSelected(nodeId) { dojo.io.bind({ url:
> "<s:url
> >> value='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>
> >>
> >> I put in logging inside every method of my dynamicTreeSelectAction
> >> action, but nothing gets logged, so I gather that the node selection is
> >> not properly handled.  Can someone explain to me what is going on in
> >> this script and why my action is never being called.
> >>
> >> If you need to see the s:tree declaration, here it is: <td width="90%"
> >> valign="top"> <div style="margin-right: 50px;"> <s:tree theme="ajax"
> >> rootNode="%{treeRootNode}" childCollectionProperty="childrenNodes"
> >> nodeIdProperty="id" nodeTitleProperty="name"
> >> treeSelectedTopic="treeSelected"> </s:tree> </div>
> >>
> >> <div id="displayId"></div> </td>
> >>
> >> There used to be some instruction text between the <div
> >> id="displayId"></div> tag, but I removed it.  There's a reference to
> >> this div in the script above, but I don't know how it's being used.
> >>
> >> Any help would be truly appreciated.
> >>
> >> Best, Session
> >>
> >>
> >>> Hi,
> >>>
> >>> I was able to get the selected item from a s:select element, which
> >>> can
> >> be
> >>> accessed from the property variable that is associated with it.  Now
> >>> I'm trying to do the same with the s:tree element.  But it seems as
> >>> though there is no property object association with s:tree.  How would
> >>> I go about getting a user's tree node selection from code?
> >>>
> >>> Thanks, Session
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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: Gettin the selected item in a s:tree

Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
Do you have an example, because I know nothing about YUI.

Also, I saw in the link you provided that there is a workaround for dojo, but I can't even check it out because I downloaded dojo and followed the HelloWorld tutorial, but it doesn't work.  I don't know what files/jars to include in my project for the dojo code to work.

Could you send me an example of the workaround you used?

Thanks,
Session


> I'm under the impression that the selected topic publishing isn't
> currently working in Struts 2. At least the examples in the showcase app
> aren't working for me (in Firefox 2.0.0.6). When I had to do something
> similar I found this: 
> http://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.pl
> ugin.system.issuetabpanels:all-tabpanel
> 
> It says that it's fixed in 2.1.0, but since that isn't released yet, I
> just decided to implement the tree using YUI and writing all the
> javascript parts manually (it isn't very hard anyway).
> 
> On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
>> 
>> Hi again,
>> 
>> Anyone has a clue about obtaining a user's selection in an s:tree 
>> element?  I used the example from the showcase, and I don't fully
>> understand the following script:
>> 
>> <script> function treeNodeSelected(nodeId) { dojo.io.bind({ url: "<s:url
>> value='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>
>> 
>> I put in logging inside every method of my dynamicTreeSelectAction
>> action, but nothing gets logged, so I gather that the node selection is
>> not properly handled.  Can someone explain to me what is going on in
>> this script and why my action is never being called.
>> 
>> If you need to see the s:tree declaration, here it is: <td width="90%"
>> valign="top"> <div style="margin-right: 50px;"> <s:tree theme="ajax" 
>> rootNode="%{treeRootNode}" childCollectionProperty="childrenNodes" 
>> nodeIdProperty="id" nodeTitleProperty="name" 
>> treeSelectedTopic="treeSelected"> </s:tree> </div>
>> 
>> <div id="displayId"></div> </td>
>> 
>> There used to be some instruction text between the <div 
>> id="displayId"></div> tag, but I removed it.  There's a reference to
>> this div in the script above, but I don't know how it's being used.
>> 
>> Any help would be truly appreciated.
>> 
>> Best, Session
>> 
>> 
>>> Hi,
>>> 
>>> I was able to get the selected item from a s:select element, which
>>> can
>> be
>>> accessed from the property variable that is associated with it.  Now
>>> I'm trying to do the same with the s:tree element.  But it seems as
>>> though there is no property object association with s:tree.  How would
>>> I go about getting a user's tree node selection from code?
>>> 
>>> Thanks, Session
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> 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: Gettin the selected item in a s:tree

Posted by Toni Lyytikäinen <to...@gmail.com>.
I'm under the impression that the selected topic publishing isn't currently
working in Struts 2. At least the examples in the showcase app aren't
working for me (in Firefox 2.0.0.6). When I had to do something similar I
found this:
http://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

It says that it's fixed in 2.1.0, but since that isn't released yet, I just
decided to implement the tree using YUI and writing all the javascript parts
manually (it isn't very hard anyway).

On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
>
> Hi again,
>
> Anyone has a clue about obtaining a user's selection in an s:tree
> element?  I used the example from the showcase, and I don't fully understand
> the following script:
>
> <script>
>     function treeNodeSelected(nodeId) {
>         dojo.io.bind({
>             url: "<s:url value='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>
>
> I put in logging inside every method of my dynamicTreeSelectAction action,
> but nothing gets logged, so I gather that the node selection is not properly
> handled.  Can someone explain to me what is going on in this script and why
> my action is never being called.
>
> If you need to see the s:tree declaration, here it is:
> <td width="90%" valign="top">
>   <div style="margin-right: 50px;">
>     <s:tree
>       theme="ajax"
>       rootNode="%{treeRootNode}"
>       childCollectionProperty="childrenNodes"
>       nodeIdProperty="id"
>       nodeTitleProperty="name"
>       treeSelectedTopic="treeSelected">
>     </s:tree>
>   </div>
>
>   <div id="displayId"></div>
> </td>
>
> There used to be some instruction text between the <div
> id="displayId"></div> tag, but I removed it.  There's a reference to this
> div in the script above, but I don't know how it's being used.
>
> Any help would be truly appreciated.
>
> Best,
> Session
>
>
> > Hi,
> >
> > I was able to get the selected item from a s:select element, which can
> be
> > accessed from the property variable that is associated with it.  Now I'm
> > trying to do the same with the s:tree element.  But it seems as though
> > there is no property object association with s:tree.  How would I go
> > about getting a user's tree node selection from code?
> >
> > Thanks, Session
> >
> >
> > --------------------------------------------------------------------- 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: Gettin the selected item in a s:tree

Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
Hi again,

Anyone has a clue about obtaining a user's selection in an s:tree element?  I used the example from the showcase, and I don't fully understand the following script:

<script>
    function treeNodeSelected(nodeId) {
        dojo.io.bind({
            url: "<s:url value='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>

I put in logging inside every method of my dynamicTreeSelectAction action, but nothing gets logged, so I gather that the node selection is not properly handled.  Can someone explain to me what is going on in this script and why my action is never being called.

If you need to see the s:tree declaration, here it is:
<td width="90%" valign="top">
  <div style="margin-right: 50px;">
    <s:tree
      theme="ajax"
      rootNode="%{treeRootNode}"
      childCollectionProperty="childrenNodes"
      nodeIdProperty="id"
      nodeTitleProperty="name"
      treeSelectedTopic="treeSelected">
    </s:tree>
  </div>

  <div id="displayId"></div>
</td>

There used to be some instruction text between the <div id="displayId"></div> tag, but I removed it.  There's a reference to this div in the script above, but I don't know how it's being used.  

Any help would be truly appreciated.

Best,
Session


> Hi,
> 
> I was able to get the selected item from a s:select element, which can be
> accessed from the property variable that is associated with it.  Now I'm
> trying to do the same with the s:tree element.  But it seems as though
> there is no property object association with s:tree.  How would I go
> about getting a user's tree node selection from code?
> 
> Thanks, Session
> 
> 
> --------------------------------------------------------------------- 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