Hi...

just try to add this short script to the page that contains your tree...
Might possibly be not the most beautiful solution, but works for me!

        dojo.event.topic.subscribe("tree/treeCreate", function 
treeCreated(node) {
                // get all treenodes and iterate through
        var nodes = dojo.widget.getWidgetsByType("StrutsTreeNode");
                var i;
                for(i=0; i< nodes.length; i++) {
                        nodes[i].expand();
                }
                //Just another thing you might find useful - preselect another 
node
                var node = dojo.widget.getWidgetById("<%= 
request.getSession().getAttribute("PreselectedCategory") %>");
                node.expand();
                node.markSelected();

                // Thats how I use the treecontrol to refresh a list...
                document.DocumentListSelection.NodeID.value = <%= 
request.getSession().getAttribute("PreselectedCategory") %>;
                dojo.event.topic.publish('ListSelectionFilled');
    });

Hope that helps!

Regards Jan

-----Ursprüngliche Nachricht-----
Von: Narayana S [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 12. September 2008 09:16
An: Struts Users Mailing List
Betreff: Re: Struts 2.1 Tree Problem

i found solution to the parent node item.

here is the code snippet ..
*tree construction *
<sx:tree id="contentTree" name="contentTree"
            label="Root" treeSelectedTopic="treeSelected"
expandedNotifyTopics="treeExpand">
-----
-----
</sx:tree>
*java Script code *
<script language="javascript">
dojo.event.topic.subscribe("treeExpand", function treeNodeExpanded(message)
{
         alert(message.node.widgetId);
    });
</script>

while constructing the tree expandedNotifyTopics attribute can be used to
specify the function to be executed while expanding the tree, when a node is
expanded i am taking that root node and preserve in a variable... so when a
node is selected what is there in the parent variable is the parent node.

still i didn't find a way to show tree extended default... any help is
greatly appreciated.

Thanks in advance

On Fri, Sep 12, 2008 at 12:06 PM, Jukka Välimaa <[EMAIL PROTECTED]>wrote:

> As far as I know, there is no way to set some nodes already extended
> server-side. You can open the nodes you want client-side using javascript,
> however.
> On Fri, Sep 12, 2008 at 6:48 AM, Narayana S <[EMAIL PROTECTED]>
> wrote:
>
> > Hi Jim,
> >
> >            Thanks for your reply, tree control default shows only root
> > node, but
> > 1. i want it to be shown extended by default to show the specified active
> > node.
> > 2. if i pass any node i want to find out the parent node of that node in
> > the
> > jsp page itself (in DOJO)
> >
> > i am kind of stuck in my process...  help me.
> >
> >
> >
> >
> > On Thu, Sep 11, 2008 at 6:23 PM, Jim Kiley <[EMAIL PROTECTED]>
> wrote:
> >
> > > We aren't deliberately ignoring you... many readers of this list are in
> > the
> > > Americas, and you sent your first message after most of us went to bed
> > and
> > > your followup before most of us woke up. :-)
> > > (I have no idea what the answer to your question is, I have not used
> the
> > > tree control at all -- but what have you tried? Can you share your code
> > > with
> > > us so that we can help point you in the right direction?)
> > >
> > > jk
> > >
> > > On Thu, Sep 11, 2008 at 5:08 AM, Narayana S <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > > > did any one see this email.... please help me
> > > >
> > > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <[EMAIL PROTECTED]
> >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > >    now i am working with tree control, when i load the tree i want
> to
> > > > load
> > > > > it default extended and what ever the node id i pass that should be
> > > > > activated. how i can achieve this using struts 2.1 version. and one
> > > more
> > > > > thing is when i select a node in the jsp page itself i have to find
> > out
> > > > the
> > > > > parent of the node selected.
> > > > >
> > > > > please help me to solve this issue, i am kind of stuck..
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jim Kiley
> > > Technical Consultant | Summa
> > > [p] 412.258.3346 [m] 412.445.1729
> > > http://www.summa-tech.com
> > >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to