A rich:contextMenu is not working correctly when used with rich:tree. For example, consider the following:
<rich:tree id="tree" var="node"
toggleType="ajax" toggleListener="#{node.onNodeToggle}"
selectionType="ajax" selectionChangeListener="#{myBean.onNodeSelection}">
<rich:treeModelRecursiveAdaptor roots="#{myBean.treeRoots}" nodes="#{node.childNodes}">
<rich:treeNode id="treeNode">
<h:panelGrid columns="2" border="0" cellpadding="0px" cellspacing="0px">
<h:graphicImage value="/images/data_icon.gif" />
<h:outputText value="#{node.data.id}" />
</h:panelGrid>
<rich:contextMenu attached="true" target="treeNode" mode="ajax">
<rich:menuItem label="#{node.data.id}" disabled="true"/>
<rich:menuItem label="Show" mode="server" action="#{myBean.show}"/>
</rich:contextMenu>
</rich:treeNode>
</rich:treeModelRecursiveAdaptor>
</rich:tree>
When the context menu coded as above is rendered, it is clipped by the borders of its parent tree node, so I can only see a narrow band corresponding to the topmost portion of the menu. I see enough to verify that the label of the first menu item has correct value
If I move rich:contextMenu to outside of rich:tree, the menu is rendered only at the initial right-click. After that, I see only the browser's context menu. After some experimentation, I've added render="@form" to rich:treeNode.
Either way, I still get an occasional script error 'this.popup' is null or not an object, after expanding a tree node.
|