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 <[EMAIL PROTECTED]>
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
>

Reply via email to