0 Replies Latest reply on May 21, 2007 5:16 AM by shmoula

    Redraw whole tree after delete treenode

    shmoula

      Hi all!
      I have problem with rerendering tree component after child delete. Im trying to do a lazy loading tree with add, move, rename...functionality. It partikulary works, but removing doesnt.

      A part of view:

      <a4j:outputPanel id="treeOutput">
       <rich:tree value="#{SessionBean.fileTree}" var="item" nodeFace="directory" id="fileTree">
       <rich:treeNode type="directory">
       <a4j:commandLink value="#{item.dirName}"
       action="#{SessionBean.treeNodeClicked}"
       actionListener="#{item.nodeClicked}"
       reRender="listPanel,treeOutput,infoPanel" />
       </rich:treeNode>
       </rich:tree>
       </a4j:outputPanel>
      
      
      <a4j:commandButton alt="Delete" action="#{SessionBean.directoryDeleteClicked}"
       reRender="treeOutput" />
      


      File tree getter returns only model built in Session Constructor:
      private DirectoryNode rootNode;
      
      public TreeNode getFileTree(){
       return (TreeNode)this.rootNode;
       }
      


      Adding or removing changes database and this model; delete func:
      public String directoryDeleteClicked(){
       Directory directory = this.selectedDirectoryNode.getDirectoryObject();
      
       this.rootNode.removeChild(directory.getId().toString());
       directory.getParent().getChildren().remove(directory);
       this.applicationBean.directoryLocal.delete(directory);
      
       return null;
       }
      


      Model is changed, but tree component doesnt take any change (in delete case). Where I'm wrong, please?