2 Replies Latest reply on Mar 9, 2009 2:46 AM by Nick Belaevski

    How can I refresh a rich:tree from the popup window

    Chico Chen Newbie

      Use a rich:tree to open the popup ie window, after saving, I need to refesh the tree and keep it's open status, thanks.

      <!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">
        <script>
         function openWin(url) {
          window.open(url, '_blank', 'height=400, width=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
       }
        </script>
      
       <rich:panel id="main">
       <h:panelGrid columns="2">
      
       <rich:panel id="left" bodyClass="rich-laguna-panel-no-header">
      
       <h:form>
       <rich:contextMenu attached="false" id="menu" submitMode="ajax">
      
       <rich:menuItem ajaxSingle="true"
       onclick="openWin('page/model/{childType}/{childType2}Edit.seam?{childType}Act=Add {childType2}&amp;{itemType}Id={itemId}')">
       Add Child
       </rich:menuItem>
       <rich:menuItem ajaxSingle="true"
       onclick="openWin('page/model/{itemType}/{itemType2}Edit.seam?{itemType}Act=Edit {itemType2}&amp;{itemType}Id={itemId}')">
       Edit
       <a4j:actionparam name="bask" assignTo="#{current}"
       value="Edit {itemType}" />
       </rich:menuItem>
       <rich:menuItem ajaxSingle="true"
       onclick="openWin('page/model/{itemType}/{itemType2}Delete.seam?{itemType}Act=Delete {itemType2}&amp;{itemType}Id={itemId}')">
       Delete
       <a4j:actionparam name="bask" assignTo="#{current}"
       value="Delete {itemType}" />
       </rich:menuItem>
      
       </rich:contextMenu>
      
       <rich:tree style="width:300px" switchType="ajax"
       stateAdvisor="#{treeDemoStateAdvisor}">
       <rich:treeNodesAdaptor nodes="#{projectList.resultList}"
       var="project">
       <rich:treeNode>
       #{project.name}
       <rich:componentControl event="oncontextmenu" for="menu"
       operation="show">
       <f:param name="itemId" value="#{project.id}" />
       <f:param name="itemType" value="project" />
       <f:param name="itemType2" value="Project" />
      
       <f:param name="childType" value="module" />
       <f:param name="childType2" value="Module" />
       </rich:componentControl>
       </rich:treeNode>
       <rich:treeNodesAdaptor nodes="#{project.moduleSet}" var="module">
       <rich:treeNode>
       #{module.name}
       <rich:componentControl event="oncontextmenu" for="menu"
       operation="show">
       <f:param name="itemId" value="#{module.id}" />
       <f:param name="itemType" value="module" />
       <f:param name="itemType2" value="Module" />
      
       <f:param name="childType" value="suite" />
       <f:param name="childType2" value="Suite" />
       </rich:componentControl>
       </rich:treeNode>
       <rich:treeNodesAdaptor nodes="#{module.suiteSet}" var="suite">
       <rich:treeNode>
       #{suite.name}
       <rich:componentControl event="oncontextmenu" for="menu"
       operation="show">
       <f:param name="itemId" value="#{suite.id}" />
       <f:param name="itemType" value="suite" />
       <f:param name="itemType2" value="Suite" />
      
       <f:param name="childType" value="case" />
       <f:param name="childType2" value="Case" />
       </rich:componentControl>
       </rich:treeNode>
       <rich:treeNodesAdaptor nodes="#{suite.caseSet}" var="case">
       <rich:treeNode>
       <h:commandLink value="#{case.name}">
       <a4j:support event="onclick" actionListener="#"
       reRender="rightPanel" requestDelay="0" />
       <a4j:actionparam name="bask1" assignTo="#{current}"
       value="Edit Case" />
       </h:commandLink>
       <rich:componentControl event="oncontextmenu" for="menu"
       operation="show">
       <f:param name="itemId" value="#{case.id}" />
       <f:param name="itemType" value="case" />
       <f:param name="itemType2" value="Case" />
      
       <f:param name="childType" value="case" />
       <f:param name="childType2" value="Case" />
       </rich:componentControl>
       </rich:treeNode>
       </rich:treeNodesAdaptor>
       </rich:treeNodesAdaptor>
       </rich:treeNodesAdaptor>
       </rich:treeNodesAdaptor>
       </rich:tree>
      
       </h:form>
      
       </rich:panel>
      
       <s:div id="right">
       <a4j:outputPanel id="rightPanel" ajaxRendered="true">
       <rich:panel styleClass="p100">
       <f:facet name="header"></f:facet>
       <h:outputText value="#{current}"></h:outputText>
       </rich:panel>
       </a4j:outputPanel>
       </s:div>
      
       </h:panelGrid>
       </rich:panel>
      
       </ui:define>
      </ui:composition>