I've been using primefaces 3.0 for testing purposes. I've been testing the tree component in particular. I am hoping to integrate this component in an existing JSF 2.0 application. Because I've already styled all my components and don't want to start styling primefaces buttons again I want to use this component with a plain old h:commandButton.
After submitting the form, the page rerenders and the tree collapses losing all its state. How can I prevent this? Snippet below:
Code: Select all
<h:form id="form" preprendId="false">
<table>
<tr>
<th>File locations</th>
</tr>
<tr>
<td><p:tree value="#{treeController.root}" var="node" width="600px;"
selectionMode="checkbox"
selection="#{treeController.selectedNodes}"
propagateSelectionUp="true" propagateSelectionDown="true"
id="tree" nodeExpandListener="#{treeController.onNodeExpand}"
dynamic="true" cache="true">
<p:treeNode>
<h:outputText value="#{node.getName()}" />
</p:treeNode>
</p:tree> </td>
</tr>
<tr>
<td><h:commandButton action="#{treeController.save}" value="Save"> <p:ajax event="action" process="@form" update="@form" /></h:commandButton></td>
</tr>
</table>
</h:form>
Code: Select all
<td><h:commandButton action="#{treeController.save}" value="Save"><f:ajax render="@form" execute="@form" /></h:commandButton></td>
Code: Select all
<td><p:commandButton action="#{treeController.save}" value="Save" update="@form"></p:commandButton></td>
Is this a known bug for dynamic trees? How can I submit the form while keeping tree state at the same time?
Any help greatly appreciated!
Jarno