1 Reply Latest reply on Sep 8, 2011 5:00 PM by Dana Heath

    a4j:commandLink not triggering a4j:param assignment when using rich:componentControl

    Dana Heath Newbie

      I have an a4j:param within an a4j:commandLink that isn't making the assignment due to the additional presence of the rich:componentControl within it. Essentially I need to set the id of an object before the rich:popupPanel shows. I'm using the rich:componentControl to position the popupPanel at a specific location on the screen

       

      Anyone run into this before? (I'm using RF 4.0). The following code is a facelet being included in an a4j:repeat (elsewhere) and without the rich:componentControl works but doesn't place the popup where I want it.

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

                xmlns:ui="http://java.sun.com/jsf/facelets"

                xmlns:a4j="http://richfaces.org/a4j"

                xmlns:rich="http://richfaces.org/rich"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en">

                <ui:composition >

                          <li>

                                    <a4j:commandLink id="ll" render="actionbar" style="color:white;" limitRender="true">

                                              <a4j:param name="babyId" value="#{baby.id}" assignTo="#{babyBean.id}"/> <!-- not working -->

                                              <img src="#{baby.photoUrl}" class="marker"/>

                                              <div class="name">#{baby.name}</div>

                                              <a4j:outputPanel layout="block" rendered="#{not empty siteCheckedinBean.eventMap[baby.id]}"

                                                        styleClass="ribbon_#{siteCheckedinBean.eventMap[baby.id].eventType.label}" />

                            <rich:componentControl event="mousedown" operation="show" target="actionbar">

                                <a4j:param name="event" value="event" noEscape="true" />

                                <rich:hashParam>

                                    <a4j:param noEscape="true" name="top"

                                        value="jQuery(#{rich:element('ll')}.parentNode).offset().top + jQuery(#{rich:element('ll')}.parentNode).height() - 80" />

                                    <a4j:param noEscape="true" name="left"

                                        value="jQuery(#{rich:element('ll')}.parentNode).offset().left + 7" />

                                </rich:hashParam>

                            </rich:componentControl>

                                    </a4j:commandLink>

                             </li>

                </ui:composition>

      </html>


      Thanks in advance

        • 1. Re: a4j:commandLink not triggering a4j:param assignment when using rich:componentControl
          Dana Heath Newbie

          For anyone who is interested, I created a workaround for this problem by using an a4j:jsFunction to make the backing bean update. I added the 'onmouseover' event on the a4j:commandLink and called the jsFunction that subsequently re-rendered the popupPanel

           

          Just an aside... if you do this, don't re-render the popupPanel itself, but place an a4j:outputPanel directly inside the popupPanel and render the outputPanel, otherwise you're likely to get the dreaded "RichFaces.$(...) is undefined" javascript error (which is what was happening for me).

           

          After all was said and done, I completely abandoned this approach since it was horribly unstable probably but only because it just didn't work in this case due to the number of UI elements on the page that were requesting updates via javascript.

           

          Just thought I'd share my two cents on the problem.