7 Replies Latest reply on Feb 28, 2011 7:15 AM by Roman Mandeleil

    rich:panelMenu and h:outputLink

    Roman Mandeleil Newbie

      Hi fellows,

       

       

      I am trying to use my own links with rich menu item to make the html more crawler frendly.

      Here is my code:

       

                                <rich:panelMenu style="width:150px" event="onclick"  mode="none" id="leftPanelMenu"
                                     iconExpandedGroup="disc" iconCollapsedGroup="disc"
                                     iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
                                     iconCollapsedTopGroup="chevronDown" iconItem="triangle" >
      
      
      
      
                                     <rich:panelMenuGroup label="Main Menu"  expanded="true"   id="mainMenuGroup_1">
      
      
      
      
                                         <rich:panelMenuItem >
      
      
                                             <h:outputLink id="home-link" value="/#{applicationBean.appname}/page/home.xhtml"
                                                     style="text-decoration:none">
      
      
                                                 Home
                                             </h:outputLink>
      
      
                                         </rich:panelMenuItem>
      
      
      
      
                                         <rich:panelMenuItem label="Item 2" action="exchange-board"/>
                                         <rich:panelMenuItem label="Item 3"     action="account-info" />
                                     </rich:panelMenuGroup>
      
      
                                 </rich:panelMenu>
      
      

       

       

      and the effect I get is: that been rederected only if click on the text inside the menu item,

      but if I click on spaces inside the item there is no action. Is there any sollution for that ?

       

      Thanks in advance

      Roman

        • 1. Re: rich:panelMenu and h:outputLink
          Mark Paluch Master

          Hi Roman,

          how does your HTML-Output look like? A better approach would be skipping Body-Text within your outputLink.

           

          Try

           

          <h:outputLink id="home-link" value="/#{applicationBean.appname}/page/home.xhtml"

                                                        style="text-decoration:none">

          <h:outputText value="Home"/></h:outputLink>

           

           

          Best regards,

          Mark

          • 2. Re: rich:panelMenu and h:outputLink
            Roman Mandeleil Newbie

            Hi Mark,

             

            Nop that gives me the same HTML, looks like that:

             

             

            <tr id="row_j_id10:j_id11"><td class="rich-pmenu-nowrap rich-pmenu-item-icon ">

                 <img src="/demo/a4j/g/3_3_2.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconSpacer/DATB/eAH7cW0fAAVVAo0_.jsf*.xhtml" alt="" height="16" width="16">

            <img src="/demo/a4j/g/3_3_2.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconTriangle/DATB/eAH7cW0fAAVVAo0_.jsf*.xhtml" alt="" width="16" height="16" id="leftIconj_id10:j_id11"></td>

             

            <td class="rich-pmenu-group-self-label rich-pmenu-item-label" id="iconj_id10:j_id11" style="width:100%">

            <input autocomplete="off" name="panelMenuActionj_id10:j_id11" type="hidden">

            <a id="j_id10:home-link" name="j_id10:home-link" href="/demo/page/home.xhtml" style="text-decoration:none">                                           Home</a></td>

            <td><img src="/demo/a4j/g/3_3_2.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconSpacer/DATB/eAH7cW0fAAVVAo0_.jsf*.xhtml" alt="" width="16" height="16" id="rightIconj_id10:j_id11"></td></tr>

            • 3. rich:panelMenu and h:outputLink
              Mark Paluch Master

              Hi Roman,

              it seems, that the only way to achieve your goal would be setting onclick="location='...'" on rich:panelMenuItem. Regular Navigation is also handled by JavaScript.

               

              Best regards,

              Mark

              • 4. rich:panelMenu and h:outputLink
                Roman Mandeleil Newbie

                Hi Mark,

                 

                Yep , I guess it is the sollution , very ugly

                but if I don't have other option...

                 

                Thanks.

                Roman

                • 5. rich:panelMenu and h:outputLink
                  Mark Paluch Master

                  Hi Roman,

                  what you could try, but you would still define your link twice is, to leave the action in the rich:panelMenuItem and additionally define your h:outputLink. So you could reduce ugliness :-)

                   

                  Best regards,

                  Mar

                  • 6. Re: rich:panelMenu and h:outputLink
                    Ilya Shaikovsky Master
                     <rich:panelMenuItem name="Item_1_1" mode="client">
                        <h:outputLink style="display:block; width:100%; height:100%" value="www.google.com">
                             Home
                        </h:outputLink>
                     </rich:panelMenuItem>
                    

                     

                    But that will works completelly fine only if set icons to 'none'. In other case there will be "non-clickable" parts there.

                     

                    Actually seems better to create own behavior which will encode proper navigation JS and put to onclick in client mode.

                    • 7. Re: rich:panelMenu and h:outputLink
                      Roman Mandeleil Newbie

                      Thanks Ilya it's better now