2 Replies Latest reply on Apr 23, 2008 2:36 PM by Nick Belaevski

    Tree don't expand in 3.1.4GA

    vivian hu Novice

      It worked before in 3.0.1. But not working any more after upgrade to 3.1.4GA.

      show a tree and bind the tree to the bean.

       <h:outputText value="#{desktopBean.sviHelper.test}"/>
       <rich:tree style="width:300px"
       id="parentVMTree"
       switchType="client"
       value="#{desktopBean.sviHelper.parentVMRoot}"
       binding="#{desktopBean.sviHelper.parentVMTree}"
       var="item"
       nodeFace="#{item.selectable ? 'selectable' : 'nonSelectable'}" >
      


      js function to expand the tree and reRender it to show it expanded.
       <a4j:jsFunction name="expandVmTree"
       actionListener="#{desktopBean.sviHelper.expandVMTree}"
       reRender="parentVMTreePanel,test,scriptPanel,errorPanelTemp">
       </a4j:jsFunction>
      


      Java side to expand the tree.

       public void expandVMTree(ActionEvent evt) {
       if ( vmImageRoot.isLeaf()) {
       Util.addMessage(FacesMessage.SEVERITY_ERROR, Util
       .getString("ErrorGetTemplate"), "");
       return;
       }
       try {
       vmTree.queueExpandAll();
       test = "new";
       } catch (IOException e) {
       LOGGER.error(e);
       }
       }
      
      


        • 1. Re: Tree don't expand in 3.1.4GA
          vivian hu Novice

          Can you help?

          • 2. Re: Tree don't expand in 3.1.4GA
            Nick Belaevski Master

            Hello,

            The following page works ok for me in 3.1.4.GA:

            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
            
            <f:subview id="treeSubviewID">
             <a4j:outputPanel ajaxRendered="true">
             <h:messages />
             </a4j:outputPanel>
            
             <rich:tree id="tree" switchType="client" value="#{bean.data}" var="data" binding="#{treeBean1.tree}">
            
             <f:facet name="icon">
             <h:outputText value="icon" rendered="#{bean.renderFacets}" />
             </f:facet>
             <f:facet name="iconLeaf">
             <h:outputText value="leaf" rendered="#{bean.renderFacets}" />
             </f:facet>
             <f:facet name="iconExpanded">
             <h:outputText value="expanded" rendered="#{bean.renderFacets}" />
             </f:facet>
             <f:facet name="iconCollapsed">
             <h:outputText value="collapsed" rendered="#{bean.renderFacets}" />
             </f:facet>
            
             <rich:dndParam name="treeParam" value="Tree Parameter" />
             <rich:dndParam name="accept" value="accept" />
            
             <rich:treeNode type="input" dropListener="#{bean.processDrop}"
             oncollapse="Element.removeClassName(event['treeItem'].getElement(), 'colored')"
             onexpand="Element.addClassName(event['treeItem'].getElement(), 'colored')">
             <h:outputText value="#{data} : " />
             <h:inputText value="#{data.name}" required="true" styleClass="inputs">
             </h:inputText>
            
             <rich:dndParam name="nodeParam" value="Node Parameter" />
            
             </rich:treeNode>
             <rich:treeNode type="text" nodeClass="customNode" acceptedTypes="file2" onselected="return false;">
             <h:outputText value="#{data}" />
             </rich:treeNode>
             </rich:tree>
            
             <a4j:jsFunction name="expandVmTree"
             actionListener="#{treeBean1.onaction}"
             reRender="tree">
             </a4j:jsFunction>
            
             <f:verbatim>
             <script type="text/javascript">
             window.onload = expandVmTree;
             </script>
             </f:verbatim>
            
            </f:subview>
            


            That is the page included in the master page that contains f:view, h:form, etc.