2 Replies Latest reply on Feb 16, 2016 5:53 AM by sivaprasad9394

    rich:contextMenu with h:outputLink not firing the event in RF 4.5.13

    sivaprasad9394

      Hello,

       

      Trying to fire the link url via rich:contextMenu with h:output link.My url has been generated properly but ,by clicking the menu nothing happens.

       

      for contextMenu class="rf-ctx-itm rf-ctx-itm-sel"  It is Selected state.

       

      Here I am clicking exactly the Link Text in the Menu.Not out side of the text.If it is outside the link text means onclick event need to be added in rich:menuItem.

      Here <a> tag is generated and all looks fine.But by clicking the menu nothing happens....??

       

      <rich:contextMenu showEvent="contextmenu" mode="client" target="cn1">

                      <rich:menuItem mode="client">               

                             <h:outputLink target="_blank" value="#{_data.counterName.shortid.shortid}" >

                              #{messages.gotoresource}

                              </h:outputLink>

      </rich:menuItem>

       

      ctx.png

       

      Thank you.

        • 1. Re: rich:contextMenu with h:outputLink not firing the event in RF 4.5.13
          michpetrov

          contextMenu stops event propagation when you click on a menuItem (as does every menu, I think). It cancels the navigation even though you've clicked on the link, looks like a browser feature. You have to use onclick.

          • 2. Re: rich:contextMenu with h:outputLink not firing the event in RF 4.5.13
            sivaprasad9394

            Yes you are correct.
            I have modified the code as like below to make it work,

            <rich:contextMenu showEvent="contextmenu" mode="client" target="cn">

                                <rich:menuItem >                   

                                    <a4j:commandLink target="_blank"

                                         onclick="gotoresourceWindow('#{_data.counterName.shortid.shortid}')">

                                           <h:outputText value="#{messages.gotoresource}" />                            

                                    </a4j:commandLink>

                                </rich:menuItem>

            </rich:contextMenu>

             

            <script type="text/javascript">

                function gotoresourceWindow(url) {

                    window.open(url);

                }

            </script>

             

            Thank you.