Avoid p: treeTable nodes to collapse after update

i has a p:treeTablein form and a p:dialogin another form, where from p:dialogi add data top:treeTable

when sending h:commandButtonin a dialog I add an update p:treeTableto orded to see the added node

The problem is that all the extended nodes that the user has opened will be destroyed

I found this question Preventing dropping p: treeTable after the update , which in the question he wrote solved, but there is an answer or solution for his question

+4
source share
3 answers

, node java . ajax .

JSF/Faces:

<p:tree ...>
    <p:ajax event="expand" listener="#{backing.nodeExpand}" />
    <p:ajax event="collapse" listener="#{backing.nodeCollapse}" />
...
</p:tree>

Java/:

public void nodeExpand(NodeExpandEvent event) {
    event.getTreeNode().setExpanded(true);      
}

public void nodeCollapse(NodeCollapseEvent event) {
    event.getTreeNode().setExpanded(false);     
}
+11

- actionListener , node , , .

node.setExpanded(true);
node.getParent().setExpanded(true);
+1

All Articles