OK, I tried removing my <h:form> tags, and that kind of works with the
nodes that are already loaded, but my action listener that I had
attached to my <h:commandLink> doesn't get invoked when clicking on the
plus sign. This action listener loads the child elements from the
database when the user expands the node, so, if the children are not yet
loaded, clicking the plus sign does nothing. (Clicking the icon defined
in the commandLink body still invokes the action listener.) Here's my
sample tree (with the actionListener defined):
<x:tree2 id="serverTree" value="#{treeBacker.treeData}"
var="node" varNodeToggler="t" clientSideToggle="false">
<f:facet name="type1">
<h:panelGroup>
<h:commandLink immediate="true"
action="#{t.toggleExpanded}"
actionListener="#{treeBacker.processAction}">
<h:graphicImage
value="/images/type1.gif" border="0"/>
</h:commandLink>
<h:outputLink value="#"
style="font-family: arial; color: blue"
onclick="alert(#{node.id})"><h:outputText
value="#{node.name}"/></h:outputLink>
</h:panelGroup>
</f:facet>
<f:facet name="type2">
<h:panelGroup>
<h:commandLink immediate="true"
action="#{t.toggleExpanded}"
actionListener="#{treeBacker.processAction}">
<h:graphicImage
value="/images/type2.gif" border="0"/>
</h:commandLink>
<h:outputText value="#{node.name}"
style="font-family: arial; color: blue"/>
</h:panelGroup>
</f:facet>
</x:tree2>
I guess it makes sense that the actionListener would not get invoked
except when the icon is clicked, since it's the icon that's in the body
of the commandLink. I can't figure out how to get the actionListener
invoked when clicking on the plus sign, since the plus sign navigation
control is internal to the Tree2 component.
- Brendan
P.S. Even if I get the above working, I am a little disturbed about the
<h:form> thing. Ordinarily most of our screens include
<h:form>...</h:form>, so the request sends all the other values the user
has filled in. I'm not quite sure why this control would only work if
there weren't <h:form> actions. Is there something I'm missing?
-----Original Message-----
From: Frank Langelage [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 30, 2005 2:09 PM
To: MyFaces Discussion
Subject: Re: Clicking on the + in Tree2
CONNER, BRENDAN (SBCSI) wrote:
>Any idea why I have to click on my gif (rather than the plus sign
>navigation icon) to get the node to expand?
>
>- Brendan
>
>
>
We had the same problem a few weeks ago.
The x:tree2 was inside an h:form.