I use my own plus and minus image instead of hardcoding the tomahawk
images. Is also better to turn off the by adding attribute showLines=
"false". Also I am not sure if reRender="tree". I had to wrap the tree
with a <h:panelGroup id="treePanel"> or <a4j:outputPanel id="treePanel">
and reRender="treePanel". see below
<t:tree2 value="#{dao.treeModel}" id="tree" var="node"
showNav="false" clientSideToggle="false"
showLines="false"
varNodeToggler="t">
<f:facet name="content">
<h:panelGroup>
<a4j:commandLink action="#{t.toggleExpanded}" reRender="tree"
rendered="#{!node.leaf}">
<t:graphicImage style="border:0px" url="#{t.nodeExpanded ?
'/images/tree/nav-plus.gif' : '/images/tree/nav-minus.gif' }" />
<h:outputText value="#{node.uri}"/>
</h:panelGroup>
</f:facet>
</t:tree2>
BTW, I will post my code to a blog soon.. I will send the link to this
mail list once I have time to finish it..
Bill
Roger Keays
<[EMAIL PROTECTED]
havenue.com.au> To
Sent by: news [email protected]
<[EMAIL PROTECTED] cc
rg>
Subject
Re: ajax4jsf + tree2?
09/21/2006 07:46
PM
Please respond to
"MyFaces
Discussion"
<[EMAIL PROTECTED]
ache.org>
Roger Keays wrote:
> Hi Bill,
>
>> I had no problem with it, what kind of tree behavior are you looking
for?
>> lazy loading? ajax expend-collapse? clickable treenode that does ajax
>> request? etc
>
> I'm looking for AJAX expand-collapse when the +/- icon is clicked. It
> would be okay if the entire tree was refreshed, just not the entire page!
Okay, so the trick is to use showNav="false" and make your own
navigation togglers with an a4j:commandLink. It works, but it is
difficult to make the new links look just like the originals. I gave it
a shot (see below), but it still looks pretty ugly.
Perhaps a better solution would be a new tree2 attribute called
'a4jToggle', which when set to true puts in the magic a4j javascript
(not sure exactly what that looks like) instead of the standard js.
<t:tree2 value="#{dao.treeModel}" id="tree" var="node"
showNav="false" clientSideToggle="false"
varNodeToggler="t">
<f:facet name="content">
<h:panelGroup>
<a4j:commandLink action="#{t.toggleExpanded}" reRender="tree"
rendered="#{!node.leaf}">
<h:graphicImage
value="/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11588409/tree2.HtmlTreeRenderer/images/nav-#{t.nodeExpanded
? 'minus' : 'plus'}-line-middle.gif"
style="border: 0px;"/>
</a4j:commandLink>
<h:graphicImage
value="/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11588409/tree2.HtmlTreeRenderer/images/line-middle.gif"
rendered="#{node.leaf}" style="border: 0px;"/>
<h:outputText value="#{node.uri}"/>
</h:panelGroup>
</f:facet>
</t:tree2>
>
> One other thing though.. I see lots of references to AJAX lazy loading.
> What is that supposed to mean? AFAICT tree2 supports lazy loading out of
> the box, and it has nothing to do with AJAX. Just set
> clientSideToggle="false".
>
> Cheers,
>
> Roger
>
>>
>> Hi there,
>>
>> Does anybody have experience integrating ajax4jsf with MyFaces' tree2
>> component? I can't see anything in ajax4jsf that will work out of the
>> box (a4j:support, a4j:region and a4j:form don't do the trick).
>>
>> Cheers,
>>
>> Roger
>
>
--
----------------------------------------
Ninth Avenue Software
p: +61 7 3137 1351 (UTC +10)
f: +61 7 3102 9141
w: http://www.ninthavenue.com.au
e: [EMAIL PROTECTED]
----------------------------------------
Disclaimer: This electronic mail and any attachments are confidential and may
be privileged. If you are not the intended recipient, please notify the sender
immediately by replying to this email, and destroy all copies of this email and
any attachments. Thank you.