3 Replies Latest reply on Jul 11, 2013 2:54 PM by bleathem

    Richfaces maintaining state between page refreshes (panelmenu)

    divyapbend

      I am building a rechfaces application. Something similar to

      How to ajax-refresh the main content part by navigation menu?

      I am using template approach (separate .xhtml files for header, footer, left navigation menu, and centre content..and a common layout.xhtml as a template) and a Panelmenu group to group items on my left navigation menu.

      The code for my navigation menu is below.

       

      <h:panelGrid columns="2" columnClasses="cols,cols" width="200">
            
      <rich:panelMenu style="width:200px" expandMode="server"
            
      groupExpandedLeftIcon="triangleUp"               
            
      groupCollapsedLeftIcon="triangleDown"
            
      topGroupExpandedRightIcon="chevronUp"               
            
      topGroupCollapsedRightIcon="chevronDown"
            
      itemLeftIcon="disc" >        <rich:panelMenuGroup label="BillView" >
             
      <rich:panelMenuItem label="Home"  action="home.xhtml">
             
      </rich:panelMenuItem>
             
      <rich:panelMenuItem label="Contact" action="Contact.xhtml">
             
      </rich:panelMenuItem>
             
      <rich:panelMenuItem label="About Us" action="about.xhtml">
             
      </rich:panelMenuItem>
         
      </rich:panelMenuGroup>

         
      <rich:panelMenuGroup label="Test1" >
         
      <rich:panelMenuItem label="Test1.1"  action="test1.1.xhtml">
             
      </rich:panelMenuItem>
             
      <rich:panelMenuItem label="Test1.2"  action="test1.2.xhtml">
             
      </rich:panelMenuItem>
         
      </rich:panelMenuGroup>      

      </rich:panelMenu>

      </h:panelGrid>

       

      The problem is , whenever I click on one of the submenu options from ym left nav menu (e.g. Test1.1), the left navigation menu collapses back. I need it to remain expanded and the selected submenu highlighted.

      I know we might have to implement a session scoped bean, but I am not sure of the implementation steps. Can you please explain in detail as I am a total newbie

      Thanks