1 Reply Latest reply on Mar 31, 2008 4:25 AM by Kerdudou Ronan

    Tree : Expand All

    Tomas Cerny Novice

      I have a question about expanding whole tree.

      tomahawk tree2 is able to open expand all tree so I would like to do something similar with this tree.

      Does anyone already solved it?

      Thanks

        • 1. Re: Tree : Expand All
          Kerdudou Ronan Apprentice

          "tomahawk tree2 is able to open expand all tree"...
          not so easy, nearly a hack to do this... or maybe there's a new way of doing it that i don't know ?

          for rich:tree, i don't know but with rich:(recursiveT|t)reeNodesAdaptor i manage to do it.
          I've got my own tree structure that contains a "isExpended" boolean on nodes (here named "isDeplie"),

          //adviseNodeOpened="#{handler.adviseNodeOpened}"
           public Boolean adviseNodeOpened(UITree tree) {
           BeanNoeud bn = (BeanNoeud)tree.getRowData();
           if (bn==null) {
           return Boolean.TRUE;
           }
           return new Boolean(bn.isDeplie());
           }
          
          //changeExpandListener="#{handler.processExpansion}"
           public void processExpansion(NodeExpandedEvent event) throws AbortProcessingException {
           HtmlTree arbre = (HtmlTree)event.getSource();
           BeanNoeud bn = (BeanNoeud)arbre.getRowData();
           if (bn.isDeplie()) {
           bn.setDeplie(false);
           }else{
           bn.setDeplie(true);
           }
           }
          I don't think this is a solution to do, but if you already have a tree structure and just want to now use richfaces tree to render it, this way seems quite cool :-)