1 Reply Latest reply on Jan 6, 2011 8:24 AM by Wilian Domingues

    Dynamic rich:Tree no refresh a child node after persist or remove

    Wilian Domingues Newbie

      Good morning everyone!


      I have worked in a dynamic rich:tree with rich:recursiveTreeNodesAdaptor and not work after persist/remove a new child node.


      The tree just refresh after I press F5's button or acess the page from menu.


      The method ppaMarcaModeloHome.listaPpaMarcaModelo() returns the List of PpaMarcaModelo.


      My code:


      <rich:panel id="panel" header="Cadastro de Marca/Modelo">
                              
              <a:region id="campos" >
              
                      <rich:tree id="treeTestTree" switchType="client" ajaxSubmitSelection="true" reRender="tree" ajaxSingle="true">  
                      <rich:recursiveTreeNodesAdaptor id="tree" 
                              roots="#{ppaMarcaModeloHome.listaPpaMarcaModelo()}" var="node"  
                              nodes="#{node.itensFilhos}">  
                              <rich:treeNode data="#{node.codPpaMarcaModelo}" >
                                      <table width="800">
                                              <tr>
                                                      <td width="34%">
                                                              <a:commandLink action="#{ppaMarcaModeloHome.find()}" value="#{node.nome}" reRender="descricaoField,marcaModeloPaiField,codPpaMarcaModeloPai" ajaxSingle="true"
                                                                                              rendered="#{s:hasPermission('ppaMarcaModeloHome','find')}"
                                                                                              disabled="#{!s:hasPermission('ppaMarcaModeloHome', 'update')}">
                                                                      <f:param name="codPpaMarcaModelo" value="#{node.codPpaMarcaModelo}"/>
                                                              </a:commandLink>
                                                      </td>
                                                      <td width="33%">
                                                              <a:commandLink action="#{ppaMarcaModeloHome.incluirSubItem()}" value="Incluir Sub-Item" reRender="descricaoField,marcaModeloPaiField,codPpaMarcaModeloPai" ajaxSingle="true"
                                                                                              rendered="#{s:hasPermission('ppaMarcaModeloHome','incluirSubItem')}">
                                                                      <f:param name="codPpaMarcaModelo" value="#{node.codPpaMarcaModelo}"/>
                                                              </a:commandLink>
                                                      </td>
                                                      <td width="33%">
                                                              <a:commandLink action="#{ppaMarcaModeloHome.remove()}" value="Excluir" reRender="treeTestTree,descricaoField,marcaModeloPaiField,codPpaMarcaModeloPai,ppaMarcaModelo" ajaxSingle="true"
                                                                                              rendered="#{s:hasPermission('ppaMarcaModeloHome','remove')}">
                                                                      <f:param name="codPpaMarcaModelo" value="#{node.codPpaMarcaModelo}"/>
                                                              </a:commandLink>
                                                      </td>
                                              </tr>
                                      </table>
                              </rich:treeNode>  
                      </rich:recursiveTreeNodesAdaptor>  
                      </rich:tree>
      
              
                      <h:inputHidden id="codPpaMarcaModeloPai" value="#{ppaMarcaModeloHome.codMarcaModeloPai}"/>
                        
          <s:decorate id="marcaModeloPaiField" template="/layout/edit.xhtml">
              <ui:define name="label">Marca/Modelo Pai</ui:define>
              <h:inputText id="marcaModeloPai"                            
                          size="40"
                    maxlength="40"
                        value="#{ppaMarcaModeloHome.nomeMarcaModeloPai}"
                      readonly="true"
                      disabled="true">                            
                  <a:support event="onblur" reRender="marcaModeloPaiField" bypassUpdates="true" ajaxSingle="true"/>
              </h:inputText>
          </s:decorate>
                      
              
          <s:decorate id="descricaoField" template="/layout/edit.xhtml">
              <ui:define name="label">Nome</ui:define>
              <h:inputText id="descricao"
                      required="true"
                          size="40"
                    maxlength="40"
                        value="#{ppaMarcaModeloHome.instance.nome}">
                  <a:support event="onblur" reRender="descricaoField" bypassUpdates="true" ajaxSingle="true"/>
              </h:inputText>
          </s:decorate>
              </a:region>
                      
              <div style="clear:both">
                  <span class="required">*</span>
                  Campos Obrigatórios
              </div>
      
      </rich:panel>
      <div class="actionButtons">
      
      <h:commandButton id="save"
                value="Gravar"
                action="#{ppaMarcaModeloHome.persist}"
              disabled="#{!ppaMarcaModeloHome.wired}"
              rendered="#{!ppaMarcaModeloHome.managed and s:hasPermission('ppaMarcaModeloHome','persist')}"/>
      
      <h:commandButton id="update"
                value="Atualizar Dados"
                action="#{ppaMarcaModeloHome.update}"
              rendered="#{ppaMarcaModeloHome.managed and s:hasPermission('ppaMarcaModeloHome','update')}"/>
      
      <h:commandButton id="delete"
                value="Excluir"
                action="#{ppaMarcaModeloHome.remove}"
            immediate="true"
              rendered="#{ppaMarcaModeloHome.managed and s:hasPermission('ppaMarcaModeloHome','remove')}"/>
      
      <h:commandButton id="novo"
                value="Novo"
                action="#{ppaMarcaModeloHome.novo}"
            immediate="true"/>
      
      </div>




      Ps.: Sorry for my bad english.