node population in tree dynamic="true"

UI Components for JSF
Post Reply
xRinox
Posts: 12
Joined: 14 Jul 2010, 18:30

15 Nov 2010, 18:34

Hi again,

I've learned a lot from my last post, now I've almost completed my nice side dynamic menu. Just one small step is in the middle, i hope someone has solved it before. When i'm done i'll be happy to publish the code for other beginners like me.

I have some trees with dynamic="true", I'm using the nodeExpandListener to populate the children dynamically. The problem is when I expand a folder, an ajax processing icon is shown and the listener fires and executes ok, but the processing icon never stops and the nodes never get shown.

Maybe it's a 2.2RC2 problem? I'll rollback to 2.2RC1 later when i get home to give it a try, but maybe some of you can give some other tips!

Thanks in advance,

Renzo.
PrimeFaces-2.2.RC2-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Facelets, GlassFish 3.0.1

xRinox
Posts: 12
Joined: 14 Jul 2010, 18:30

17 Nov 2010, 05:06

Found out with this post: http://primefaces.prime.com.tr/forum/vi ... =tree+ajax what i was trying to do is a known issue, and will be fixed in a later 2.3 version of primefaces.

Issue: Ajax nodes population in p:tree doesn't work with other treeNode than p:outputText.

I'm using outputlLinks for the actual options in here, and my tree looks darn good, so I've stopped trying to do the lazy child loading.

Anyways, I got really close by adding first level lazy loading. Achieved this with help of the great p:dataGrid and p:fieldset. Here's the code that made it work nicely, if anyone wants some more details i'll be happy to post. I even made it work with Java Authentication and Authorization Service (JAAS) :mrgreen:

Code: Select all

<p:outputPanel id="panelSideMenu">
<p:outputPanel id="rdPanelSideMenu" rendered="#{!empty userController.loggedUser}">
    <h2>Opciones</h2>
    <h:form prependId="false" id="frmSideMenu">
        <p:dataGrid value="#{userController.sideMenu}" var="menuL1" columns="1"
                    id="gridSideMenu">
            <p:column>
                <p:fieldset toggleable="true" legend="#{menuL1.label}" collapsed="#{menuL1.collapsed}"
                         toggleListener="#{menuL1.handleToggle}" onToggleUpdate="gridSideMenu:content">
                    <p:outputPanel id="content">
                        <!-- si el contenido aun tiene 0 hijos, mostrar el status ajax -->
                        <h:graphicImage value="#{resource['images:ajax-loader.gif']}"
                                        width="16" height="16" rendered="#{menuL1.root.childCount le 0}"/>
                        <p:tree value="#{menuL1.root}" var="doc"
                                nodeExpandListener="#{menuL1.onNodeExpand}">
                            <p:treeNode type="folder">
                                <h:outputText value="#{doc.descripcion}"/>
                            </p:treeNode>
                            <p:treeNode type="option">
                                <h:outputLink styleClass="optionStyle"
                                    value="#{doc.direccion}">#{doc.descripcion}</h:outputLink>
                            </p:treeNode>
                        </p:tree>
                    </p:outputPanel>
                </p:fieldset>
            </p:column>
        </p:dataGrid>
    </h:form>
</p:outputPanel>
</p:outputPanel>
Thank you primefaces!
PrimeFaces-2.2.RC2-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Facelets, GlassFish 3.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests