3 Replies Latest reply on Jun 3, 2009 8:36 AM by ilya_shaikovsky

    Problem: contextMenu for tree !

    allforjava

      Dear Team,

      Towards:

      <rich:tree id="issuesTree" switchType="client"
       reRender="outpanel"
       rightClickSelection="true"
       nodeSelectListener="#{issuesHome.selectionListener}">
       <rich:treeNodesAdaptor var="issue" nodes="#{issuesList.resultList}">
       <rich:treeNode>
       <h:outputText id="issueIDOutputText" value="#{issue.issueId}"/>
       <rich:contextMenu submitMode="ajax" id="issueContextMenu" attached="true" attachTo="issueIDOutputText" >
       <rich:menuItem action="#{issuesHome.remove}"
       reRender="outpanel, issuesOutputPanel"
       oncomplete="Richfaces.showModalPanel('Issue Deleted!');">
       <h:graphicImage value="/img/recy.png" border="0" align="down"/>
       <h:outputText value=" #{resourceBundle.labels['list.delete']} #{issuesHome.instance.id}"/>
       </rich:menuItem>
       <rich:menuSeparator/>
       <rich:menuItem>
       <h:graphicImage value="/img/edit.gif" border="0"/>
       <h:outputText value=" Add"/>
       </rich:menuItem>
       </rich:contextMenu>
       <a:support event="ondblclick" reRender="outpanel, issuePanel, workLogPanel"/>
       </rich:treeNode>
       </rich:treeNodesAdaptor>
       </rich:tree>


      1. On Delete menuitem of contextMenu, it is not displaying the selected Issue ID. What am I missing?

      2. After delete or Add the tree is not rerendered. When does menuItem reRender works?

      Thank you in advance!

        • 1. Re: Problem: contextMenu for tree !
          ilya_shaikovsky

          1) attached="true" attachTo="issueIDOutputText"

          attached=true means that menu will be attached to parent. Why you using attachTo?

          2) Can't see reRender on add menuItem.

          3) will the outputText with Issue ID will be diplayed fine if just defined as child of treeNode?

          • 2. Re: Problem: contextMenu for tree !
            allforjava

             

            "ilya_shaikovsky" wrote:
            1) attached="true" attachTo="issueIDOutputText"

            attached=true means that menu will be attached to parent. Why you using attachTo?

            So that only when the nodes text is selected context menu to be displayed. Further I found such workaround in some of the RF posts. Is it a right way?

            "ilya_shaikovsky" wrote:

            2) Can't see reRender on add menuItem.


            For Add menuitem yet to be implemented once done with http://www.jboss.org/index.html?module=bb&op=viewtopic&t=156399. However, for delete menuitem added as reRender="outpanel, issuesOutputPanel". Do I need to work with onComplete? Please guide.

            "ilya_shaikovsky" wrote:

            3) will the outputText with Issue ID will be diplayed fine if just defined as child of treeNode?


            The tree is generated fine with nodes, only. For any other clarifcation please elaborate.

            Thank you for your intervention!

            • 3. Re: Problem: contextMenu for tree !
              ilya_shaikovsky

              checked with this code and could see the EL label evaluated ok in menuItem and also tree defined in reRender is present in ajax-update-ids .

               <rich:tree switchType="client" style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}" rightClickSelection="true" id="tree" ajaxKeys="#{null}">
               <rich:treeNode type="artist" iconLeaf="/images/tree/singer.gif" icon="/images/tree/singer.gif" ajaxSubmitSelection="true">
               <rich:contextMenu attached="true" submitMode="ajax">
               <rich:menuItem value="#{item.name}" reRender="tree"/>
               </rich:contextMenu>
               <h:outputText value="#{item.name}" />
               </rich:treeNode>
              ...