1 Reply Latest reply on Nov 27, 2012 7:36 AM by genrico

    rich:component and rich:tooltip interaction

    genrico

      Hi there,

       

      Since RichFaces' last update (4.2.2) dealing with rich:tooltip problems, the rich:tooltip is now using the Javascript Service feature from RichFaces instead of the classic Javascript implementation. My problem is that, since then, my tooltip isn't working.

       

      I have a notification system using a4j:push that update a mail counter and notify the user with a tooltip.

       

      Here is my notificationPanel.xhtml

       

      <a4j:push address="notificationAddress#{uiNotifications.login}" ondataavailable="updateNotificationsInformations(event.rf.data)">
          <a4j:ajax event="dataavailable" execute="@this" render="@none" />
      </a4j:push>
      
      <a4j:jsFunction name="updateNotificationsInformations" execute="@this" limitRender="true" action="#{uiNotifications.updateNotifications}"
          oncomplete="#{rich:component('newNotificationsTooltip')}.show()" render="notificationsPanel,mailCounter,newNotificationsTooltip" >
          <a4j:param name="param1" assignTo="#{uiNotifications.idNotification}" />
      </a4j:jsFunction>
      

       

      And my tooltip is in controlNotificationsIcon.xhtml

      <h:panelGroup id="newNotificationsContainer" layout="block" />
      
      <h:form>
          <rich:tooltip id="newNotificationsTooltip" styleClass="tooltip"
              target="newNotificationsContainer" layout="block" attached="false"        
              hideDelay="2000">
              <span> Vous avez 1 nouveau message.</span>
          </rich:tooltip>
      </h:form>
      

       

       

      On the javascript console of my browser, i have this error

      Uncaught TypeError: Cannot call method 'show' of undefined
      (anonymous function)
      serverEventHandlerrichfaces.js.html:499
      curryrichfaces.js.html:475
      richfaces.createJSFEventsAdapterrichfaces.js.html:428
      sendEventjsf.js.html:1442
      responsejsf.js.html:2079
      richfaces.queue.responserichfaces-queue.js.html:413
      jsf.ajax.responserichfaces-queue.js.html:50
      onCompletejsf.js.html:1227
      req.xmlReq.onreadystatechange
      

       

      Well, seems the rich:component doesn't find my tooltip, but I don't understand why. It was working perfectly in the previous versions.

      Any ideas ?

        • 1. Re: rich:component and rich:tooltip interaction
          genrico

          Well, I have been investigating recently about this problem. In fact, it's not the rich:component that is the cause of the problem, but rather the use of the "show()" method (or "hide()") in a <a4j:jsFunction>. If I use the show() on a tooltip in another component (the push, for exemple), it's working.

           

          I'm trying to find a solution to force the tooltip to show (and hide) outside of a jsFunction, but it may not be that trivial.