I have the following tree with 3 types of nodes.
<p:tree id="tree" value="#{treeViewBackingBean.root}"
var="item"
style="width:auto; ">
<p:ajax event="expand" process="@this" listener="#{treeViewBackingBean.onNodeExpand}" />
<p:ajax event="collapse" process="@this" listener="#{treeViewBackingBean.onNodeCollapse}" />
<p:treeNode type="NegotiatingUnit" >
...
</p:treeNode>
<p:treeNode type="UnionHeader" >
...
</p:treeNode>
<p:treeNode type="Union" >
...
</p:treeNode>
</p:tree>
<p:commandButton action="#{treeViewBackingBean.save}" update="tree" id="save" value="save" />
In the node expand event I set the property expanded to true so that post refresh the node stays expanded.
public void onNodeExpand(NodeExpandEvent event) {
System.out.println("onNodeExpand() " + event + " event " + event.getTreeNode().isExpanded());
event.getTreeNode().setExpanded(true);
}
The problem here is the save button doesn't work when even one of the nodes are expanded?
Is changing treenode object on expand event causing any trouble? how to get this fixed.
I have started working with primefaces 4 in JBoss EAP 6.1 environment.