1 Reply Latest reply on Feb 27, 2009 7:39 AM by Nick Belaevski

    recursiveTreeNodesAdaptor - dynamic loading Problem

    heapifyman heapifyman Newbie

      Hello all,

      I have a question regarding rich:tree component and recursiveTreeNodesAdaptor. I'm just trying to get to know the tree component. I have created a single entity bean that has a parent-child relationship with itself and want to display that structure in a rich:tree. I found the recursiveTreeNodesAdaptor example and got it working: tree is correctly displayed and expands and collapses alright.
      Now to my question: I've noticed that apparently on every collapse/expand the whole tree is reloaded, i.e. there are a lot of database queries. For my little example that's fine but I suppose for more complex entities and a lot more entries in the database that could be a performance problem.
      What I'd like to have is that only the part of the tree that is expanded is reloaded. How would I accomplish that? I've found the ajaxSingle attribute but setting it to true didn't change anything.
      Any hints would be appreciated. Thanks.

      Btw, I'm using JBoss Seam 2.1.1.GA and thus Richfaces 3.2.2.SR1. Below is my current xhtml:

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j"
       template="layout/template.xhtml">
      
      <ui:define name="body">
      
       <rich:panel>
       <f:facet name="header">TreeTest</f:facet>
       <h:form>
       <rich:tree id="treeTestTree"
       switchType="ajax"
       ajaxSingle="true"
       adviseNodeOpened="#{treeTestList.adviseNodeOpened}">
       <rich:recursiveTreeNodesAdaptor
       id="treeTestRecursiveTreeNodesAdaptor"
       roots="#{treeTestList.rootNodes}"
       var="_treeTest"
       nodes="#{_treeTest.children}" >
       <rich:treeNode>
       <h:outputText value="#{_treeTest.name}" />
       </rich:treeNode>
       </rich:recursiveTreeNodesAdaptor>
       </rich:tree>
       </h:form>
       </rich:panel>
      
      </ui:define>
      
      </ui:composition>