Hi,
I have a tree2 component on a page and generate the dataModel to populate the
tree using TreeModel class which is instantiated in the constructor of the
backing bean of the page. The backing bean has a session scope, but it seems
like every time one chooses a node on the tree, the Tree2 gets rebuilt - or at
least I can see it via the log traces. Is there something to disable this
behavior, or something I'm not doing right?
Here is the relevant code:
<t:tree2 id="clientTree" value="#{treeBacker.treeData}" var="node"
varNodeToggler="t"
binding="#{treeBacker.tree}">
=====================
<f:facet name="document">
<h:panelGroup>
<h:commandLink id="report_link" immediate="false"
styleClass="#{t.nodeSelected ?
'documentSelected':'document'}"
action="#{treeBacker.processSelectAction}">
<t:graphicImage value="../../img/document.png"
border="0" />
<h:outputText value="#{node.description}" />
<f:param name="docNum"
value="#{node.identifier}" />
</h:commandLink>
</h:panelGroup>
</f:facet>
====================
<managed-bean>
<managed-bean-name>treeBacker</managed-bean-name>
<managed-bean-class>
com.csfb.fao.clr.reports.controller.TreeHandler
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
In the backing bean (TreeHandler.java)
In constructor:
=========================
public TreeHandler() {
treeModel = new TreeModel();
//some other code here
}
Obtaining the treeModel:
public TreeNode getTreeData() throws Exception {
return treeModel.getTreeData();
}
When I put the following line into the backing bean constructor, the behavior
seems to become what I'm looking for - no reconstructing of the tree for every
click on its node.
if(treeModel == null) {
treeModel = new TreeModel();
}
Could someone please help me understand this.
Thank you,
Simeon
==============================================================================
Please access the attached hyperlink for an important electronic communications
disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================