context menu on a rich tree does not work in some cases
alexanndre.granier Sep 26, 2013 9:08 AMHi,
I would like to use a context menu on a tree. And this context menu has to re-render before to be displayed to enable or disable some menu depending on the node clicked. More over I would like to have a popupPanel status while processing the ajax request.
here's the jsf
<h:form id="form" prependId="true"> <rich:tree id="tree" nodeType="item" var="node" value="#{myBean.nodes}" toggleType="client" status="waitingStatus" render="context" selectionType="ajax" selectionChangeListener="#{myBean.selectionChanged}"> <rich:treeNode type="item"> <h:outputText value="#{node.label}"/> </rich:treeNode> </rich:tree> <rich:contextMenu target="tree" mode="ajax" id="context"> <rich:menuItem label="View" mode="ajax" icon="/images/icons/open.gif"/> </rich:contextMenu> </h:form> </h:form> <rich:popupPanel id="mpstatus" moveable="false" modal="true" style="text-align: center;background-color:white;"> <h:outputText value="#{msg.loading}" style="display:block;"/> <h:graphicImage value="/images/loading.gif"/> </rich:popupPanel> <a4j:status id="waitingStatus" name="waitingStatus" onstart="#{rich:component('mpstatus')}.show('', {height:'80',width:'150'})" onstop="#{rich:component('mpstatus')}.hide()"/>
Here's the managed bean:
@ManagedBean(name="myBean") @SessionScoped public class MyBean implements Serializable{ private ArrayList<Node> nodes; private Collection<Object> selectedItems; public MyBean() { setNodes(new ArrayList<Node>()); Node n1 = new Node("node1"); Node n2 = new Node("node12"); n1.addChild(n2); getNodes().add(n1); getNodes().add(new Node("node2")); } public void selectionChanged(TreeSelectionChangeEvent event) { } public ArrayList<Node> getNodes() { return nodes; } public void setNodes(ArrayList<Node> nodes) { this.nodes = nodes; } public Collection<Object> getSelectedItems() { return selectedItems; } public void setSelectedItems(Collection<Object> selectedItems) { this.selectedItems = selectedItems; } }
So If I specify no render (in the rich:tree) and no status, the context menu works. But If I specify render either on "tree" or "context" or both, or a status "waitingStatus" the context menu does not appear anymore.
This behavior did work perfecly in RF3.
Env:RF4.3.3 Mojarra2.1.6, glassfish 3.1.2.2
Does anyone can help ?
Alex