8 Replies Latest reply on Aug 24, 2008 2:28 PM by Nick Belaevski

    Problems with panelMenuItem actionListener

    Justin G Newbie

      So I've got an application that uses a rich:panelMenu for navigation. One of my requirements is supporting the "right-click -> open link in new window" behavior for the panelMenuItems. To do this, we use an h:outputLink embedded in the panelMenuItem.

      I've got an action listener ("requiredActionListener" from code below) that must be executed every time a panelMenuItem is clicked. For some reason, the actionListener is being executed sometimes (~95% of the time), but not always. I can't nail down where exactly I need to click for the actionListener not to trigger. I think it has to do with clicking the outputLink, but don't know why since it works most of the time.

      Here is how I'm implementing it:

      <rich:panelMenu id="navigationMenu" width="143px" mode="server"
       iconExpandedTopGroup="chevronUp"
       iconCollapsedTopGroup="chevronDown"
       iconGroupTopPosition="right" iconItem="none">
      
       <rich:panelMenuGroup label="Group1" id="group1Id"
       expanded="#{navMenuBean.panelState.group1}" expandMode="ajax"
       actionListener="#{navMenuBean.switchPanel}"
       <f:param name="panel" value="group1"/>
       <rich:panelMenuItem action="item1action" id="item1Id"
       actionListener="#{someBean.requiredActionListener}">
       <h:outputLink id="link1Id" styleClass="menuLink"
       value="#{facesContext.externalContext.requestContextPath}/somePage.faces">
       <h:outputText value="Item 1"/>
       </h:ouptputLink>
       </rich:panelMenuItem>
      
       ....
      
       </rich:panelMenuGroup>
      
       ....
      
      </rich:panelMenu>
      

      The switchPanel actionListener is used to save the expanded/collapsed state of the menu during navigation (in case you're wondering).

      Again, this works most of the time, but sometimes the requiredActionListener doesn't execute when clicking the link. I also tried moving the actionListener out of the panelMenuItem attributes and embedded it within the panelMenuItem as an a4j:support onclick event. This seems to be a little better but on occasion, the actionListener still doesn't execute.

      Am I implementing this wrong? Any help would be great.

      Thanks!

      justin.