You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Marko Asplund <ma...@gmail.com> on 2007/02/27 12:04:36 UTC
How to get selected node with t:tree2?
hi
I'm having problems figuring out how to determine the selected node in
t:tree2 when a user clicks a node link. Here's what my view looks
like:
<t:tree2 var="node" value="#{navigator.treeModel.treeData}">
<f:facet name="report">
<t:commandLink value="#{node.description}"
action="#{navigator.nodeSelected}"/>
</f:facet>
</t:tree2>
With ADF Faces I could use something like the following piece of code
for getting the selected node:
public NavigatorBacking {
TreeModel tree;
public String nodeSelected() {
if(tree.isRowAvailable()) {
MyNode n = (MyNode)tree.getRowData();
// ...
}
return "success";
}
}
How do I do this with t:tree2?
Re: How to get selected node with t:tree2?
Posted by Andrew Robinson <an...@gmail.com>.
Or you can use t:updateActionListener
On 2/27/07, Adrian Mitev <ad...@googlemail.com> wrote:
> Try this:
>
> <f:facet name="report">
> <t:commandLink value="#{node.description}"
> action="#{navigator.nodeSelected}">
> <f:param name="selectedNode" value="#{ node.identifier}" />
> </t:commandLink>
> </f:facet>
>
> or t:updateActionListener
>
> 2007/2/27, Marko Asplund < marko.asplund@gmail.com>:
> > hi
> >
> > I'm having problems figuring out how to determine the selected node in
> > t:tree2 when a user clicks a node link. Here's what my view looks
> > like:
> >
> > <t:tree2 var="node" value="#{navigator.treeModel.treeData}">
> > <f:facet name="report">
> > <t:commandLink value="#{node.description}"
> > action="#{navigator.nodeSelected}"/>
> > </f:facet>
> > </t:tree2>
> >
> > With ADF Faces I could use something like the following piece of code
> > for getting the selected node:
> >
> > public NavigatorBacking {
> > TreeModel tree;
> >
> > public String nodeSelected() {
> > if(tree.isRowAvailable()) {
> > MyNode n = (MyNode)tree.getRowData();
> > // ...
> > }
> > return "success";
> > }
> > }
> >
> > How do I do this with t:tree2?
> >
>
>
Re: How to get selected node with t:tree2?
Posted by Adrian Mitev <ad...@googlemail.com>.
Try this:
<f:facet name="report">
<t:commandLink value="#{node.description}"
action="#{navigator.nodeSelected}">
<f:param name="selectedNode" value="#{node.identifier}" />
</t:commandLink>
</f:facet>
or t:updateActionListener
2007/2/27, Marko Asplund <ma...@gmail.com>:
>
> hi
>
> I'm having problems figuring out how to determine the selected node in
> t:tree2 when a user clicks a node link. Here's what my view looks
> like:
>
> <t:tree2 var="node" value="#{navigator.treeModel.treeData}">
> <f:facet name="report">
> <t:commandLink value="#{node.description}"
> action="#{navigator.nodeSelected}"/>
> </f:facet>
> </t:tree2>
>
> With ADF Faces I could use something like the following piece of code
> for getting the selected node:
>
> public NavigatorBacking {
> TreeModel tree;
>
> public String nodeSelected() {
> if(tree.isRowAvailable()) {
> MyNode n = (MyNode)tree.getRowData();
> // ...
> }
> return "success";
> }
> }
>
> How do I do this with t:tree2?
>