You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Narayana S <na...@gmail.com> on 2008/09/11 06:47:28 UTC

Struts 2.1 Tree Problem

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.

Re: Struts 2.1 Tree Problem

Posted by Narayana S <na...@gmail.com>.
Hi Jan,

            thanks for your reply, Can you give the full code (means the
tree construction details also), as i couldnt find any attributes of sx:tree
to call tree created attribute...

can you please give me more details


On Fri, Sep 12, 2008 at 1:54 PM, Jan Froehlich
<Ja...@infomotion.de>wrote:

> 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:narayanasgs1@gmail.com]
> 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 <valimaa.jukka@gmail.com
> >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 <na...@gmail.com>
> > 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 <jh...@summa-tech.com>
> > 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 <na...@gmail.com>
> > > > wrote:
> > > >
> > > > > did any one see this email.... please help me
> > > > >
> > > > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <
> narayanasgs1@gmail.com
> > >
> > > > > 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

AW: Struts 2.1 Tree Problem

Posted by Jan Froehlich <Ja...@infomotion.de>.
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:narayanasgs1@gmail.com] 
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 <va...@gmail.com>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 <na...@gmail.com>
> 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 <jh...@summa-tech.com>
> 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 <na...@gmail.com>
> > > wrote:
> > >
> > > > did any one see this email.... please help me
> > > >
> > > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <narayanasgs1@gmail.com
> >
> > > > 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2.1 Tree Problem

Posted by Narayana S <na...@gmail.com>.
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 <va...@gmail.com>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 <na...@gmail.com>
> 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 <jh...@summa-tech.com>
> 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 <na...@gmail.com>
> > > wrote:
> > >
> > > > did any one see this email.... please help me
> > > >
> > > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <narayanasgs1@gmail.com
> >
> > > > 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
> > >
> >
>

Re: Struts 2.1 Tree Problem

Posted by Jukka Välimaa <va...@gmail.com>.
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 <na...@gmail.com> 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 <jh...@summa-tech.com> 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 <na...@gmail.com>
> > wrote:
> >
> > > did any one see this email.... please help me
> > >
> > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <na...@gmail.com>
> > > 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
> >
>

Re: Struts 2.1 Tree Problem

Posted by Narayana S <na...@gmail.com>.
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 <jh...@summa-tech.com> 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 <na...@gmail.com>
> wrote:
>
> > did any one see this email.... please help me
> >
> > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <na...@gmail.com>
> > 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
>

Re: Struts 2.1 Tree Problem

Posted by Jim Kiley <jh...@summa-tech.com>.
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 <na...@gmail.com> wrote:

> did any one see this email.... please help me
>
> On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <na...@gmail.com>
> 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

Re: Struts 2.1 Tree Problem

Posted by Narayana S <na...@gmail.com>.
did any one see this email.... please help me

On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <na...@gmail.com> 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.
>