3 Replies Latest reply on Nov 10, 2009 10:28 AM by Matt Davis

    rich:jquery with custom jquery functions?

    Matt Davis Newbie

      I'm trying to get a <rich:jQuery tag to call a javascript function that is included an a4j:loadScript tag. I can call the method through the onclick from a standard html button, but I can't call it using rich:jQuery.

      Should this work? Am I doing something wrong?

      <h:commandButton onclick="loadStatex(this)" value="Load State 3" />
      
      <rich:jQuery name="loadState" timing="onload" query="load_state(3)" />


      I've tried onJScall, immediate and onload for rich:jQuery.

        • 2. Re: rich:jquery with custom jquery functions?
          Matt Davis Newbie

          I don't understand how that is relevant nbelaevski, but thanks for taking the time to respond.

          My code should've looked like this:

          <h:commandButton onclick="loadStatex(this)" value="Load State 3" />
          
          <rich:jQuery name="loadStatex" timing="onload" query="load_state(3)" />


          Is there a limitation with rich:jQuery that prevents me from calling nonstandard methods? The examples show this :

          <h:graphicImage width="50" value="/images/price.png" onmouseover="enlargePic(this, {pwidth:'60px'})" onmouseout="releasePic(this)" />
          
          <h:graphicImage width="50" value="/images/discount.png" onmouseover="enlargePic(this, {pwidth:'100px'})" onmouseout="releasePic(this)" />
          
          ...
          
          <rich:jQuery name="enlargePic" timing="onJScall" query="animate({width:param.pwidth})" />
          
          <rich:jQuery name="releasePic" timing="onJScall" query="animate({width:'50px'})"/>
          
          


          I've tried it with and without the "this" argument.

          Anyway, this seems critical in determining if richfaces and JQuery actually work together.

          • 3. Re: rich:jquery with custom jquery functions?
            Matt Davis Newbie

            Mm, I see what you're getting at now. So it's like adding a click handler to the button in the jquery code.

            If I don't comment that nobody would ever figure out how the hell that works, heh. So backwards!

            I'll give it a try though... thanks.