Hi Arvind,
It can be implemented by the following way.
In JSF -->

<h:form id="Form1" >
        <t:tree2 id="folderTree"
               value="#{...}"
               var="treeItem" varNodeToggler="t"
               clientSideToggle="false"
               binding="#{Bean.tree}" > 
             - - - --
             - - - -- 
     </t:tree2>
<h:inputHidden value="#{CurrentProgramsCRUD.initialExpandFlag}"/>
</h:form>

And in your backing bean keep the following

private HtmlTree _tree;
boolean initialExpandFlag=true;

public void setTree(HtmlTree tree) {
                _tree = tree;
        }

public HtmlTree getTree() {
                return _tree;
        }

public String expandAll() {
                _tree.expandAll();
                return null;
        }

public boolean isInitialExpandFlag() {
                if(initialExpandFlag){
 
_tree=(HtmlTree)FacesContext.getCurrentInstance().getViewRoot().findComponent("
Form1:folderTree");
                expandAll();
                initialExpandFlag=false;
                try {
 FacesContext.getCurrentInstance().getExternalContext()
 .redirect("home/HomePage.faces");  //change this to appropriate path
                        } catch (Exception e) {
                                e.printStackTrace();
                        }
                }
                return initialExpandFlag;
        }

public void setInitialExpandFlag(boolean initialExpandFlag) {
                this.initialExpandFlag = initialExpandFlag;
        }


Please let us know if you get any better way to implement this.

Regards,
Koushik Das






"Arvind Pandey" <[EMAIL PROTECTED]> 
07/06/2007 10:50 AM
Please respond to
"MyFaces Discussion" <[email protected]>


To
"'MyFaces Discussion'" <[email protected]>
cc

Subject
tree problem






 

Hi all, 
          i need my tree expanded every time. But in my appln it is
collapsed when the tree loaded.
I need the tree expanded every time..
 
pls help....
 
regards...
Arvind Pandey
 
 


Disclaimer: The information contained in this e-mail and attachments if 
any are privileged and confidential and are intended for the individual(s) 
or entity(ies) named in this e-mail. If the reader or recipient is not the 
intended recipient, or employee or agent responsible for delivering to the 
intended recipient, you are hereby notified that dissemination, 
distribution or copying of this communication or attachments thereof is 
strictly prohibited. IF YOU RECEIVE this communication in error, please 
immediately notify the sender and return the original message.

ForwardSourceID:NT000136AA 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


Reply via email to