You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jukka Välimaa <va...@gmail.com> on 2008/04/14 08:38:10 UTC

Ajax tree tags and forest generation - selection problem

Hi,

Right now, I'm trying to construct a "forest", or a tree menu with multiple
root nodes. I'm using struts ajax tags to do it, like so:

<s:iterator value="%{#request.generatedForest}">
    <sx:tree label="%{[0].title}"
        selectedNotifyTopics="/NodeSelected" toggle="fade"
toggleDuration="0" >
        <s:iterator value="%{[0].children}">
        <sx:treenode label="%{[0].title}" id="%{[0].id}" />
        </s:iterator>
    </sx:tree>
</s:iterator>

I have one problem (aside from ajax tags not allowing data other that title
and id to be passed by selectedNotifyTopics). When I select a node from a
tree, the other nodes in the tree are deselected, at least visually. But the
nodes I may have selected earlier in other trees of the forest remain
selected. Can any of you think of a way to get around this problem, and get
all the nodes in the forest to act in unison, so that only one of them is
visually selected at a time?

Thanks,
Jukka

How to popup a new window having detailed data on click of textbox

Posted by Rishi Deepak <de...@yahoo.com>.
I am working on Human Resource system with STRUTS1. I
have a case that  user have already entered the
employee number and its personel details in a form. 
In second form user want to  select the employee
number and employee name already entered and donot
want to type again the employee number and name. 
Kindly suggest me the way how to implement the logic
that when user click on the textbox a new window opens
and user selects the employee detail from that window
and passes the data to parent window.

Please reply urgently,
Thanks in advance.
regards
Deepak.


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

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


Re: Ajax tree tags and forest generation - selection problem

Posted by Jukka Välimaa <va...@gmail.com>.
In case anyone else will have the same problem, I'll describe a solution to
this. I use the following script to unselect the other trees:

dojo.event.topic.subscribe("/nodeSelected", function(source){
    var selectedNode = source.node;
    var selectors =
dojo.widget.manager.getWidgetsByType('struts:StrutsTreeSelector');

    /* Remove selection from selected nodes in other trees */
    var badNode = null;
    for (i=0; i < selectors.length; i++) {
        badNode = selectors[i].selectedNode;

        if (badNode != null && badNode != selectedNode) {
            selectors[i].deselect(selectors[i].selectedNode);
        }
    }
}

On Mon, Apr 14, 2008 at 9:38 AM, Jukka Välimaa <va...@gmail.com>
wrote:

> Hi,
>
> Right now, I'm trying to construct a "forest", or a tree menu with
> multiple root nodes. I'm using struts ajax tags to do it, like so:
>
> <s:iterator value="%{#request.generatedForest}">
>     <sx:tree label="%{[0].title}"
>         selectedNotifyTopics="/NodeSelected" toggle="fade"
> toggleDuration="0" >
>         <s:iterator value="%{[0].children}">
>         <sx:treenode label="%{[0].title}" id="%{[0].id}" />
>         </s:iterator>
>     </sx:tree>
> </s:iterator>
>
> I have one problem (aside from ajax tags not allowing data other that
> title and id to be passed by selectedNotifyTopics). When I select a node
> from a tree, the other nodes in the tree are deselected, at least visually.
> But the nodes I may have selected earlier in other trees of the forest
> remain selected. Can any of you think of a way to get around this problem,
> and get all the nodes in the forest to act in unison, so that only one of
> them is visually selected at a time?
>
> Thanks,
> Jukka
>