0 Replies Latest reply on Oct 21, 2011 7:48 AM by lukas.p

    External link in rich:panelMenuItem

    lukas.p

      Hi people,

       

      I would like to open an external link when users click a panelMenuItem.

       

      I came across 2 possible solutions, but they both have their flaws, so maybe you got some neat ideas on this?

       

      The simplest solution would be:

       

      <rich:panelMenuItem name="item1" >
         <h:outputLink  target="_blank"
            value="#{nav['some.hyperlink.property']}">
            <h:outputText value="Item 1"/>
         </h:outputLink>
      </rich:panelMenuItem>
      

       

      Now I get a link inside the menu item which is fine, but users have to click on the link instead of the menu item component itself and the text gets anchor css styled. This is not what a user would expect from a menu item. Well I could just use a dedicated styleClass but.. maeh..

       

      Another solution would be to use the onclick, something like:

       

      <rich:panelMenuItem  name="item2"
            onclick="window.open('#{nav['some.hyperlink.property']}')">
           <h:outputText value="Item 2"/>
      </rich:panelMenuItem>
      
      

       

      This does the job quite well, but I don't feel this as very handy and easy to maintain.

       

      Do you have any other ideas?


      Thanks!