2 Replies Latest reply on Feb 14, 2012 1:39 AM by Gaurav Pandey

    dynamic contextMenu in richfaces 4.2.0.CR1

    Gaurav Pandey Newbie

      current showcase of 4.2.0.CR1 has common menu for alll nodes:-


      <rich:contextMenu target="tree" mode="ajax">
                  <rich:menuItem label="View" render="popupContent" oncomplete="#{rich:component('popup')}.show()" mode="ajax" icon="/images/icons/open.gif"/>
      </rich:contextMenu>

       

      is it possible to assign a menuitem to a  a treenode instead of tree; i.e. target="treeNode"? , then it'll possible to show different right click menu options for different node.

      Also how can we disbale right click for a leaf node; rendered="!isLeaf" ? where should we use rendered? for rich:contextMenu Or for rich:menuItem Or for both?

        • 1. Re: dynamic contextMenu in richfaces 4.2.0.CR1
          Brendan Healey Master

          Hi, why not give it a quick try and post your findings back here for reference. It shouldn't take more than

          half an hour to do.

          • 2. Re: dynamic contextMenu in richfaces 4.2.0.CR1
            Gaurav Pandey Newbie

            my findings:-

            is it possible to assign a menuitem to a  a treenode instead of tree; i.e. target="treeNode"? ,

            -->setting target as a treeNode instead of complete tree is not working.

             

            Also how can we disbale right click for a leaf node; rendered="!isLeaf" ? where should we use rendered? for rich:contextMenu Or for rich:menuItem Or for both?

            --> tried all combinations; we should use rendered at both place; ie. rich:contextMenu  as well as rich:menuItem .

            However render on a condition is not working properly; rendered="#{treeBean.currentSelection.type eq 'nonLeaf'}" shows right click option for a leaf as well