2 Replies Latest reply on Aug 24, 2007 4:57 AM by tkalactomo

    tree, autosave state?

    yevgen_78

      Hi,

      is it possible that all opened tree nodes to save, and than if i open this page later the tree openes all opened nodes?
      So automatic restore state?

        • 1. Re: tree, autosave state?

          Hello!
          This is the way I have done it:
          On jsp page:

          <r:tree switchType="ajax" binding="#{tree}"
          value="#{someBean.data}"
          var="item" nodeFace="#{item.type}">
          


          In the upper code "binding="#{tree}"" is important.

          And in your bean:
          @Name("richTree")
          @Scope(ScopeType.CONVERSATION)
          public class RichKatalog implements RichKatalogInterface {
          
           /**
           *
           */
           private static final long serialVersionUID = -259241232787790718L;
          
           @In(required=false,create=true)
           @Out(required=false)
           private UITree tree;
          

          So you just value binded you tree in the Conversation bean,what means that your tree will save state.
          Best regards!

          • 2. Re: tree, autosave state?

            this is also usefull.You can add this methods in your bean too:

             public void expandAll() {
             try {
             tree.queueExpandAll();
             } catch (IOException e) {
             e.printStackTrace();
             }
             }
            
             public void collapseAll() {
             try {
             tree.queueCollapseAll();
             } catch (IOException e) {
             e.printStackTrace();
             }
             }
            


            Tree is outjected and injected so this will work too.