3 Replies Latest reply on Feb 13, 2009 2:50 AM by allforjava

    Problem: Rendering rich: tree using recursiveTreeNodesAdapto

    allforjava

      Hi,

      I want to perform a edit action [navigate to edit page] using contectMenu on each treeNode. Presetly the contextMenu is displayed on nodes however the page is not navigated from each node. Only selection of nodes from some nodes [first 2/3 hierarchy] menuItem action is performed.

      I'hv tried both the options
      1.contextMenu within treeNode [working partially as described above] and 2.contextMenu outside the rich:tree using componentControl

      Please guide as how it can be resolved. The code is as below [commented code, used with componentControl (2nd option) ]

      Thank you in advance !
      -------------------------------------------------------------------------------------
      TaskTree.xhtml

      <a:form id="tasksSearch" styleClass="edit">
      
       <!-- CONTEXT MENU
       <rich:contextMenu attached="true" id="treeMenu" submitMode="ajax">
       <rich:menuItem>
       Selected Task ID:<b>{taskId}</b>
       </rich:menuItem>
       <rich:menuItem action="Edit">
       <h:graphicImage value="/img/edit.gif" border="0"></h:graphicImage>
       <h:outputText value="#{resourceBundle.labels['list.edit']}"></h:outputText>
       <a:actionparam name="tasksId" value="{tasksId}"/>
       </rich:menuItem>
       </rich:contextMenu>
       -->
      
       <!-- TREE -->
       <rich:panel>
       <rich:tree id="tasksTree" switchType="client">
       <rich:recursiveTreeNodesAdaptor roots="#{tasksHome.instance.tasks == null? tasksHome.instance : tasksHome.instance.tasks}" var="taskItem" nodes="#{taskItem.taskses}">
       <rich:treeNode icon="/img/down.gif">
       <h:outputText value="#{taskItem.id}"/>
      
       <!-- Inner contextMenu -->
       <rich:contextMenu event="oncontextmenu" attached="true" id="treeMenu" submitMode="ajax">
       <rich:menuItem>
       Selected Task ID:<b>#{taskItem.id}</b>
       </rich:menuItem>
       <rich:menuItem action="Edit" limitToList="true">
       <h:graphicImage value="/img/edit.gif" border="0"></h:graphicImage>
       <h:outputText value="#{resourceBundle.labels['list.edit']}"></h:outputText>
       <f:param name="tasksId" value="#{taskItem.id}"/>
       </rich:menuItem>
       </rich:contextMenu>
       <!-- Inner contextMenu -->
      
       </rich:treeNode>
       </rich:recursiveTreeNodesAdaptor>
      
       <!-- ComponentControl within TREE
       <rich:componentControl event="onSelected" attachTo="tasksTree" for="treeMenu" operation="show">
       <f:param name="taskId" value="#{taskItem.id}"/>
       </rich:componentControl>
       -->
      
       </rich:tree>
       </rich:panel>
      
      </a:form>
      
      


      TasksTree.page.xml

      <param name="tasksId" value="#{tasksHome.tasksId}"/>
       <param name="taskId"/>
      
       <navigation from-action="Edit">
       <end-conversation />
       <redirect view-id="/TasksEdit.xhtml" />
       </navigation>
      


        • 1. Re: Problem: Rendering rich: tree using recursiveTreeNodesAd
          nbelaevski

          Hi,

          You have typo in your code: you pass taskId parameter but use {tasksId} as its value.

          About the first variant - does request happen when you click menus from non-working part?

          • 2. Re: Problem: Rendering rich: tree using recursiveTreeNodesAd
            ilya_shaikovsky

            and if the request actually occurs please check for the info from a4j:log. If there are any errors?

            • 3. Re: Problem: Rendering rich: tree using recursiveTreeNodesAd
              allforjava

              Thank you for speedy reply. However the typo ur referred is commented.

              1. I'm using "<f:param name="tasksId" value="#{taskItem.id}"/>" with the contextMenu inside the treeNode. Here the code is working partially i.e it is able to set the param value as per node selection, all of them, however the action "<rich:menuItem action="Edit" limitToList="true">" is invoked only for some nodes (upto 2nd or 3rd hierarchy). This is the problem using contextMenu within/inside the rich:treeNode (without rich:componetControl)

              2. While using the second way of coding where codes are commented (<!-- -->) with rich:contextMenu (outside the tree) and rich:componentControl (within the tree/treeNode). [To check it, codes needs to be unommented and comment the inner contextMenu. And modify "<f:param name="tasksId" value="#{taskItem.id}"/>]
              "

              I tried the suggested options modifying/checking typo however same problem persists. Kindly suggest a way.

              Anything else is required please feel free.

              I appreciate for going though this lengthy reply and thanks for it.