Hi...

Here's the code for my tree... I use struts 2.1.2 too...

<sx:tree id="tree"
        rootNode="%{RootNode}" childCollectionProperty="CategoriesNotEmpty"
        nodeIdProperty="ID" 
        nodeTitleProperty="LocalizedName"
        treeSelectedTopic="treeSelected" templateDir="/template">
</sx:tree> 

I use a custom templateDir, cause I had to remove the root Node from the Tree, 
so my Template is modified for that - if I remember right there are no other 
changes...  

Regards Jan
-----Ursprüngliche Nachricht-----
Von: Narayana S [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 7. Oktober 2008 13:21
An: Struts Users Mailing List
Betreff: Re: Tree default expanded ??

Hi Jan,

            Thanks for your reply, i am using struts 2.1.2, and for testing
i added a simple code like this...

dojo.event.topic.subscribe("tree/treeCreate", function treeCreated(node) {
        alert("Tree Loaded");
});

this is not fired after page is loaded. if possible can you give your tree
and div construct also here?



On Tue, Oct 7, 2008 at 4:11 PM, Jan Froehlich
<[EMAIL PROTECTED]>wrote:

> Hi...
>  I think I already posted that code snippet to the list, but here again
> just for you! ;)
> The code expands all nodes in my tree, and preselects a node.
> After all is done, it publishes a topic to notify a sx:div to refresh...
>
> Possibly not the best solution, but working fine for me!
> dojo.event.topic.subscribe("tree/treeCreate", function treeCreated(node) {
>    var nodes = dojo.widget.getWidgetsByType("StrutsTreeNode");
>    var i;
>    for(i=0; i< nodes.length; i++) {
>        nodes[i].expand();
>    }
>    var node = dojo.widget.getWidgetById("<%=
> request.getSession().getAttribute("PreselectedCategory") %>");
>    node.expand();
>    node.markSelected();
>    document.DocumentListSelection.NodeID.value = <%=
> request.getSession().getAttribute("PreselectedCategory") %>;
>    dojo.event.topic.publish('ListSelectionFilled');
> });
> Regards
> Jan
>
>
>
> Von: Narayana S
> Gesendet: Di 07.10.2008 12:23
> An: Struts Users Mailing List
> Betreff: Re: Tree default expanded ??
>
>
> Hello.
>
>         Please any one tell me a solution to this problem? can we do this
> in struts? if not suggest me another alternative to build tree control!! i
> am kind of stuck with this tree... it is killing me...
>
> On Tue, Oct 7, 2008 at 12:12 PM, Jukka Välimaa <[EMAIL PROTECTED]
> >wrote:
>
> > I don't know. One thing to try might be to run the expansion script after
> > you're sure the tree widget has been rendered.
> > Jukka
> >
> > On Wed, Oct 1, 2008 at 9:19 AM, Narayana S <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi,
> > >
> > >       Thanks for your reply, i tried this code but it is returning
> > > nodes.length as zero though i have a tree with 1 root and 3 child nodes
> > for
> > > root. this is my code snippet
> > > *tree
> > >
> > > *<sx:tree id="tree1" rootNode="%{rootField}"
> > > childCollectionProperty="children" nodeIdProperty="fieldID"
> > > nodeTitleProperty="fieldName" treeSelectedTopic="treeSelected"
> > > expandedNotifyTopics="treeExpanded" />
> > >
> > > *javascript*
> > >
> > > <script>
> > > var nodes =
> > dojo.widget.manager.getWidgetsByType('struts:StrutsTreeNode');
> > >     alert("Number of nodes"+nodes.length);
> > >     for( var i=0; i < nodes.length; i++){
> > >        nodes[i].expand();
> > >    }
> > > </script>
> > >
> > > what is the problem? am i missing anything? please help me to solve
> this
> > > issue.
> > >
> > > On Tue, Sep 30, 2008 at 7:49 PM, Jukka Välimaa <
> [EMAIL PROTECTED]
> > > >wrote:
> > >
> > > > As far as I know, it is not possible to expand tree widget
> server-side.
> > > > Client-side, javascript can be used to open the tree, like so:var
> nodes
> > =
> > > > dojo.widget.manager.getWidgetsByType('struts:StrutsTreeNode');
> > > > for( var i=0; i < nodes.length; i++){
> > > >     nodes[i].expand();
> > > > }
> > > >
> > > > Jukka
> > > >
> > > > On Tue, Sep 30, 2008 at 4:59 PM, Narayana S <[EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > any one who worked on tree control plz give some helping hand....
> > > > >
> > > > >
> > > > >
> > > > > On Fri, Sep 26, 2008 at 3:34 PM, Narayana S <
> [EMAIL PROTECTED]>
> > > > > wrote:
> > > > >
> > > > > > Hi
> > > > > >      Is it possible to display a tree expanded by default?
> > > > > > I am using struts 2.1.2 dojo-plugin to create the tree structure.
> > any
> > > > one
> > > > > > used tree...plz help me
> > > > > >
> > > > >
> > > >
> > >
> >
>

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

Reply via email to