I use a rich tree that displays a context menu on right click with options to edit that node. The problem is that I need to be able to access the path of the node that was right clicked in my backing bean.
A normal click triggers the nodeSelectListener. If I nest the context menu within the tree, the nodeSelectListener gets called on right click as well, which is not the behaviour I want.
I make use of the Component Control to display the contextMenu, but the action param never sets the value in the backing bean.
The path I need to store is an object.
Here is the code:
<rich:tree id="tree" switchType="ajax" ajaxSubmitSelection="true" nodeSelectListener="#{offeringsBean.processSelection}">
<rich:recursiveTreeNodesAdaptor roots="#{offeringsBean.treeRoots}" var="item" nodes="#{item.children}" >
<rich:treeNode>
<h:outputText value="#{item.node.name}"/>
<rich:componentControl event="oncontextmenu" for="optionmenu" operation="show">
<a4j:actionparam name="path" assignTo="#{offeringsBean.path}" value="#{item.node.path}"/>
</rich:componentControl>
</rich:treeNode>
</rich:recursiveTreeNodesAdaptor>
</rich:tree>
Please help me with suggestion of how to capture the path. Thanks