避免更新后p:treeTable的节点崩溃 [英] avoid nodes of p:treeTable to collapse after update

查看:119
本文介绍了避免更新后p:treeTable的节点崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个形式的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆