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

    How to select rich:panelMenuItem?

    jethroborsje

      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}" />
                       </rich:panelMenuItem>
                  </c:forEach>

              </rich:panelMenuGroup>

          </c:forEach>
      </rich:panelMenu>

       

      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,

      Jethro

        • 1. Re: How to select rich:panelMenuItem?
          ilya_shaikovsky

          check please selectedChild attribute

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

            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?
              nbelaevski

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

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

                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}"

                css

                .rich-pmenu-selected-element{
                                    background-color:#158afb;
                                    font-weight: normal;
                                    color:white;
                                    font-style:normal;
                                    font-size:12px;
                                    font-weight:bold;
                                }

                //jsp

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

                hope this will help!!!!!!