1 Reply Latest reply on Jul 19, 2007 8:22 PM by vivian hu

    rich:tree question, how to select a tree node and how to dis

    vivian hu Novice

      1. how to make a tree disabled (you can see it but can't expand or collapse it.
      2. how to programmticaly select a tree node.

        • 1. Re: rich:tree question, how to select a tree node and how to
          vivian hu Novice

          I use the binding to bind my tree to my bean. and I did the following to select a specific tree node.

           public void expandTemplateTree(ActionEvent evt) {
           try {
           TreeState ts = (TreeState)templateTree.getComponentState();
           ts.expandAll();
           ListRowKey key = getRowKey(templateRoot, this.templatePath);
           boolean is = ts.isSelected(key);
           boolean result = ts.setSelected(key);
           is = ts.isSelected(key);
           ts.saveState( FacesContext.getCurrentInstance() );
           //this.templateTree.queueExpandAll();
           } catch (IOException e) {
           e.printStackTrace();
           }
           }
          

          I can see that after ts.setSelected(key);
          the ts.isSelected(key) returned "true",
          but after reRender the tree, the tree is expanded but the tree node is not shown as selected.

          Please help.