What event should be used on a p:tree to select a tree node and have a context menu?

。_饼干妹妹 提交于 2019-12-01 13:28:08
Kukeltje

Reading the issue you reported, I investigated the code (it is open). It seems that p:tree has some undocumented events, contextMenu being one of them (dragdrop being the other).

The 5.3 java-source and 5.3 javascript-source contains references to a contextMenu event, so

<p:ajax event="contextMenu" listener="#{myBean.onContextMenu}" />

and

public void onContextMenu(NodeSelectEvent event) {
    MyTreeNode myTreeNode = (MyTreeNode) event.getTreeNode();
    myController.setSelected(myTreeNode.getEntity());
}

will work. Notice that there is no ContextMenuEvent but that it accepts/needs a NodeSelectEvent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!