p:未调用树节点选择事件侦听器方法 [英] p:tree node select event listener method is not invoked

查看:98
本文介绍了p:未调用树节点选择事件侦听器方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PrimeFaces 3.0.M4.我想在选择树节点时更新PrimeFaces布局单元的内容.我已将以下方法添加到备用bean中:

I am using PrimeFaces 3.0.M4. I want to update the contents of PrimeFaces layout unit on tree node selection. I have added the following methods to my backing bean:

public void setSelectedNode(TreeNode selectedNode) {
   this.selectedNode = selectedNode;
   this.selectedNode.setSelected(true);
}

public void onNodeSelect(NodeSelectEvent e) {
   this.setSelectedNode(e.getTreeNode());
}

在视图中,我使用ajax触发onNodeSelect()侦听器方法:

In the view I am using ajax to trigger the onNodeSelect() listener method:

<p:tree id="tree"  value="#{treeBean.root}" selection="#{treeBean.selectedNode}"     var="node" selectionMode="single" dynamic="true"  cache="false" >
  <p:ajax listener="#{treeBean.onNodeSelect}" update="test" event="select"/>
  <p:treeNode>
    <h:outputText value="#{node}"/>
  </p:treeNode>
</p:tree>

注意:该树在另一个PrimeFaces布局单元内.

Note: the tree is inside another PrimeFaces layout unit.

但是当我运行它时,根本没有调用onNodeSelect()方法.这是怎么引起的,我该如何解决?

But when I run this, the onNodeSelect() method is not called at all. How is this caused and how can I solve it?

推荐答案

update test是什么意思?

您应该发布整个xhtml代码!另外,您不应该尝试更新整个layoutUnit,而应更新表单(update="myFormId"update=":myFormId"),甚至更新表单内的面板,例如:update=":myFormId:myPanelId".

You should post your entire xhtml code! Also you should not try to update the entire layoutUnit but instead update your form (update="myFormId" or update=":myFormId") or even a panel inside the form like this: update=":myFormId:myPanelId".

这篇关于p:未调用树节点选择事件侦听器方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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