0 Replies Latest reply on Mar 11, 2010 6:35 AM by Alan Hay

    PanelMenu and Selected Item

    Alan Hay Newbie

      I have a PanelMenu and am have trouble getting it to remember its state between requests, viz when page reloads be expanded with the last selected item shown as selected.


                  <rich:panelMenu mode="server"
                      iconExpandedGroup="disc" iconCollapsedGroup="disc"
                      iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
                      <rich:panelMenuGroup label="Campaign Management" id="group_2">
                          <rich:panelMenuItem icon="/images/ficons/table_add.png" id="cm_1"
                              label="Manage Campaigns"></rich:panelMenuItem>
                          <rich:panelMenuItem icon="/images/ficons/table_multiple.png" id="cm_2"
                              label="Create New Campaign"></rich:panelMenuItem>


      MenuController is a bean in session scope to track state:


      public class MenuController
          private String selectedMenuItem;


          public String getSelectedMenuItem()
              return selectedMenuItem;


          public void select(ActionEvent event)
              selectedMenuItem = event.getComponent().getId();


      Debugging would seem to indcate that the code does what  expect [1] the action listener fires, [2] the action method fires and returns the next view, [3] getSelectedMenuItem() fires returning the id of the last selected item.


      However when the page relaods the menu is shown in collapsed state.