4 Replies Latest reply on Mar 30, 2010 8:14 AM by jsf geeks

    How to select rich:panelMenuItem?

    Jethro Borsje Newbie

      Hi all,


      I am new to RichFaces and am trying to build a generic navigation structure for my webapp. The navigation has multiple rich:panelMenu's with rich:panelMenuGroups and rich:panelMenuItems. By default one of the rich:panelMenuGroups is expanded, this works fine. Now I want to make sure one of the rich:panelMenuItems of this expanded rich:panelMenuGroup is selected. My question is this: how can I select a rich:panelMenuItem from my .xhtml code?


      My code looks like this:

      <rich:panelMenu mode="ajax" iconExpandedGroup="disc" iconCollapsedGroup="disc" iconExpandedTopGroup="chevronUp"
          iconGroupTopPosition="right" iconCollapsedTopGroup="chevronDown" topGroupClass="subTab" itemClass="taak"
          styleClass="subTabContainer" rendered="#{navigation.selectedHoofdTab == hoofdTab}">
          <c:forEach items="#{hoofdTab.subTabs}" var="subTab">
              <rich:panelMenuGroup label="#{subTab.naam}" expanded="#{subTab.defaultSubTab}">
                  <c:forEach items="#{subTab.taken}" var="taak">
                      <rich:panelMenuItem label="#{taak.naam}" action="#{navigation.doTaak}" reRender="inhoud">
                          <f:param name="url" value="#{taak.naam}" />




      I want to be able to select one of the  <rich:panelMenuItem label="#{taak.naam}" action="#{navigation.doTaak}" reRender="inhoud"> elements from inside this piece of XHTML code, how can this be done?


      Best regards,


        • 1. Re: How to select rich:panelMenuItem?
          Ilya Shaikovsky Master

          check please selectedChild attribute

          1 of 1 people found this helpful
          • 2. Re: How to select rich:panelMenuItem?
            Jethro Borsje Newbie

            Thank you for the answer, don't know how I could have missed that attribute. Setting the attribute in combination with the name of a rich:panelMenuItem 'selects' the menu item GUI-wise, but it does not perform the "action" of the rich:panelMenuItem. Is there a way to to also execute this action so that the backing bean gets updated with the selected menu item?

            • 3. Re: How to select rich:panelMenuItem?
              Nick Belaevski Master

              No, "action" is executed only after user explicitly selects item.

              1 of 1 people found this helpful
              • 4. Re: How to select rich:panelMenuItem?
                jsf geeks Master

                hi in my code i am acheiving that below

                i am populating rich panle menu from my bean class

                i have acopmlished this with selectedChild="#{contentlist.current}"


                                    font-weight: normal;


                <rich:panelMenu      width="255px" iconGroupPosition="right" selectedChild="#{contentlist.current}" expandSingle="true" binding="#{contentlist.phymenu}" id="phymenu" expandMode="ajax" iconExpandedTopGroup="chevronUp" iconCollapsedTopGroup="chevronDown">

                hope this will help!!!!!!