3 Replies Latest reply on Apr 2, 2010 10:50 AM by E Geylani

    tree expand

    E Geylani Novice

      how can i expand rich:tree after page fully loaded.

       

      thx in advance

        • 1. Re: tree expand
          Ilya Shaikovsky Master

          check treeStateAdvisor attribute or adviseNodeOpened attribute

          • 2. Re: tree expand
            Peter Len Apprentice

            I had a similar issue.  What I found out was that to control the ability to expand/collapse tree nodes programmatically, you need to do the following:

             

            1)  Define you tree's switchType as ajax.

            2) Add the attribute adviseNodeOpened which points to a method in your backing bean (ex. adviseNodeOpened="#{DataFolders.adviseNodeOpened}")

            3) Optionally,declare the attribute changeExpandListener on your treeNodes (ex. changeExpandListener="#{DataFolders.changeExpandListener}")

             

            In order to have all the tree nodes expanded, simply return "true" in your adviseNodeOpened method:

             

            public boolean adviseNodeOpened(UITree tree) {

                Object obj = tree.getRowData();

                return true;

            }

             

            This method is called for every node in the tree.  If you want to pick and choose which folders are opened, then you must check each object sent to the method and make your determination.  For example, to keep the state of the tree as is (some folders expanded and some not for example) when the tree gets reRendered due to some action, you must implement a changeExpandListener (#3 above) which calls your method each time the user expands or collapses a folder.  You must keep track on the back end which ones are open and closed and then when the adviseNodeOpened method is called, just return true for the nodes that were expanded and false for those that were not.

             

            Hope this helps

             

            • 3. Re: tree expand
              E Geylani Novice

              i made it, thx for the help.