避免更新后p:treeTable的节点崩溃 [英] avoid nodes of p:treeTable to collapse after update
问题描述
我有一个形式的p:treeTable
和另一个形式的p:dialog
,其中从p:dialog
我将数据添加到p:treeTable
i have a p:treeTable
in a form and a p:dialog
in another form where from p:dialog
i add data to the p:treeTable
在对话框的h:commandButton
提交时,我按顺序添加了p:treeTable
的更新以查看添加的节点
on submit of h:commandButton
of the dialog i add update of p:treeTable
in orded to see the added node
问题是用户打开的所有扩展节点都将折叠
The issue is that all expanded nodes the user has opened will all collapse
我发现了这个问题避免更新后p:treeTable崩溃 a>他在问题中写的解决了问题,但没有答案或解决方案
I found this question Avoiding the collapsing of p:treeTable after update which in the question he wrote solved but no answer or solution for his question
推荐答案
为避免折叠或扩展,您必须将Java端的节点标记为折叠或扩展.为此,只需添加一些ajax调用和一些侦听器方法.
To avoid collapsing or expanding you have to mark your node on the java side as collapsed or expanded. To do that that just add some ajax calls and some listener methods.
JSF/面孔:
<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);
}
这篇关于避免更新后p:treeTable的节点崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!