1 Reply Latest reply on Sep 17, 2008 7:02 AM by ilya_shaikovsky

    panelMenu: panelMenuGroup does not expand on selected items

    raimundhoelle

      Hello,

      we are trying to use panelMenu as a navigation menu for our pages, similar to the Live Demo Site.

      So we need to keep the selected item between requests. Thats not difficult, we're using the following code:

      <h:form>
       <rich:panelMenu id="#{mainMenu.menuId()}"
       expandSingle="true"
       selectedChild="#{mainMenu.currentItemId}" >
      
       <rich:panelMenuGroup name="g1" expanded="true" label="Group 1">
      
       <rich:panelMenuItem name="g1:i1" label="Item1"
       action="#{mainMenu.activateView('/testViewG1I1.xhtml','g1:i1')}" />
      
       <rich:panelMenuItem name="g1:i2" label="Item2"
       action="#{mainMenu.activateView('/testViewG1I2.xhtml','g1:i2')}" />
      
       </rich:panelMenuGroup>
      
       <rich:panelMenuGroup name="g2" expanded="true" label="Group 2">
      
       <rich:panelMenuItem name="g2:i1" label="Item1"
       action="#{mainMenu.activateView('/testViewG2I1.xhtml','g2:i1')}" />
      
       ...
      
       </rich:panelMenuGroup>
      
      
       </rich:panelMenu>
      </h:form>
      


      "mainMenu" is a simple Component to track the current item:
      @Name("mainMenu")
      @Scope(ScopeType.SESSION)
      public class MainMenu {
      
       private String currentItemId;
       private static final String MENU_ID = "mainMenu";
      
       public String getMenuId() {
       return MENU_ID;
       }
      
       public String activateView(String AViewName, String AItemId) {
       setCurrentId(AItemId);
       return AViewName;
       }
      
      
       public String getCurrentId() {
       return currentItemId;
       }
       public void setCurrentId( String ACurrentId ) {
       currentItemId = ACurrentId;
       }
      }
      


      Unfortunately, the panelMenuGroup collapses always after a request; it doesn't care the selected item.

      My questions are:
      Do i need to track the expanded state of the group also?
      If so, how can i do that in an easy way?
      How works it on the Live Demo site?

      We're currently using RF 3.2.2.GA, but the problem still occurs with 3.0-releases.

      Thanks for any help,
      Raimund