0 Replies Latest reply on Dec 1, 2010 12:31 PM by Tanya Ruttenberg

    Using controlComponent params in contextMenu items

    Tanya Ruttenberg Expert

      We know the standard example and it works as advertised:

      <rich:contextMenu id="devicemenu">

         <rich:menuItem value={devid} />


      <rich:dataTable value="#{bean.resultList}" var="_var">


            <h:outputText value="#{_var.devId}" />


          <rich:componentControl event="onRowContextMenu" for="devicemenu"

              <f:param name="devid" value="#{_var.devId}" />




      In other words, the value of #{_var.name} from the table gets passed as a parameter to the context menu and gets displayed in the menu item, represented by {name}.


      The problem I am having is how to using this value for anything other than simply displaying it.  I cannot figure out how to put it in an EL expression.  I cannot use it in any children of rich:menuItem.  So for anything other than simply displaying it, this is useless.


      I'm trying to use this menu item to navigate to another page. I've tried this


          <rich:menuItem action="device_detail" value="View details {devid}">
              <f:setPropertyActionListener  value="{devid}"
                  target="#{devicesHome.devId}"  />


      The navigation occurs on the .page.xml file.  In this case, {devid} turns up as null when I try and assign it to devicesHome.devId.


      I've tried this:


      <rich:menuItem value="View details X{devid}X" action="#{devicesHome.doSomething(devid)}"
                  rendered="#{not facesContext.externalContext.requestServletPath.contains('Device.seam')}">


      The menu is rendered with text like this: "View details X43251X"

      But devicesHome.doSomething(devid) prints this: "PRINT THIS 0"


      How can I use the value that is passed via devid other than to simply display it?