3 Replies Latest reply on May 23, 2014 4:01 AM by Michal Petrov

    [RF 4.3.5.final] panelmenu loses selected menuItem

    Tanja Schöberl Newbie



      I am using rich:panelmenu with itemMode="server". If I click on a panelMenuItem the background-color of the selected MenuItem should change.

      I have the stylingClass:

      .rf-pm-itm-sel {

          background-color: #CCCCCC;



      But when I click on a panelMenuItem the whole page is reloaded and so the menuItem only has the styleClass: "rf-pm-itm"


      If I use the itemMode="ajax", the selected menuItem has the correct styleClass.


      Is there a possibility to use itemMode="server" and to use the rf-pm-itm-sel styleClass?


      Thanks and regards,


        • 1. Re: [RF 4.3.5.final] panelmenu loses selected menuItem
          Michal Petrov Master



          I tested that and it works fine for me. What does your menu look like?

          • 2. Re: [RF 4.3.5.final] panelmenu loses selected menuItem
            Tanja Schöberl Newbie

            My xhtml:

            <ui:composition lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"

                xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich" mlns="http://www.w3.org/1999/xhtml">

                <h:head />


                    <h:panelGrid border="0" columns="2" columnClasses="colNavigation,colContent">


                            <rich:panel styleClass="navigationPanel">


                                    <div class="applicationName">

                                        <h:outputText value="Example" />


                                    <rich:panelMenu expandSingle="false"  itemMode="server" groupMode="server" >

                                        <rich:panelMenuGroup label="Person" expanded="true" >

                                            <rich:panelMenuItem label="#{msg['menuPage.new']}"   action="#{personController.newPerson}" >


                                            <rich:panelMenuItem label="#{msg['menuPage.list']}" action="list">








                            <ui:insert name="content">

                                <h:outputText value="#{msg['menuPage.welcome']}" />







            and the action:

            public String newPerson() throws Exception {

                    try {

                        this.logger.trace("newPerson(): Method started.");

                        this.newPerson = new Person();

                        this.disableInput = false;

                        return "newPerson";

                    } catch (Exception e) {

                        throw e;




            and the faces-config.xml:









            and my personNew.xhtml defines the <ui:define name="content">



            • 3. Re: Re: [RF 4.3.5.final] panelmenu loses selected menuItem
              Michal Petrov Master

              If you're changing pages then the panelMenu you see after clicking the link is a different copy, so it cannot remember what you clicked. You have to keep track of what the selected item should be - use @activeItem, its value has to be equal to the @name of the menu item.


              <rich:panelMenu expandSingle="false"  itemMode="server" groupMode="server" activeItem="#{personController.page}" >
                  <rich:panelMenuGroup label="Person" expanded="true" >
                      <rich:panelMenuItem label="#{msg['menuPage.new']}" name="#{msg['menuPage.new']}" action="#{personController.newPerson(msg['menuPage.new'])}" />
                      <rich:panelMenuItem label="#{msg['menuPage.list']}" action="list" />


              public String newPerson(String page) throws Exception {
                  this.page = page;