2 Replies Latest reply on Mar 3, 2008 9:54 AM by fdupont

    Please help with jquery

    aish

      Hi,

      I am trying to use jquery in my page.

      Here is my web page with the jquery:
      ====

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

      <rich:dataTable id="dbq" value="#{TableDetail.displaytbl}" var="dbqueue"
      border="1" >
      <f:facet name="header">
      <h:outputText value="DB Table"/>
      </f:facet>
      <rich:column>
      <f:facet name="header">
      <h:outputText value="FileNameName"/>
      </f:facet>
      <h:outputText value="#{dbqueue.filename}"/>
      </rich:column>



      <rich:jQuery selector="#dbqtr:odd" query="addClass('odd-row')" />
      <rich:jQuery selector="#dbq tr:even" query="addClass('even-row')" />
      <rich:jQuery selector="#dbq tr"
      query="mouseover(function(){jQuery(this).addClass('active-row')})"/>
      <rich:jQuery selector="#dbq tr"
      query="mouseout(function(){jQuery(this).removeClass('active-row')})"/>

      ===

      The above page is called from a main navigation page which includes the <h:form> components and so, you would not see it in the above page. I included the following styles between on the main page which has the <h:form> components.


      .odd-row {
      background-color: #ECF3FE;
      }
      .even-row {
      background-color: #FCFFFE;
      }
      .active-row {
      background-color: #FFEBDA;
      }

      ====

      The jquery is not working. Can you please point me what I missing to get this jquery to work.

      Thanks a lot
      Aish

        • 1. Re: Please help with jquery
          aish

          I noticed that my earlier post didn;t include my question. Here it is.

          The above implementation of jquery is not working. Can you please point me what I am missing to get this jquery to work?

          Should I include the jquery.js file? If so, how and where should I include it?

          Thanks a lot
          Aish

          • 2. Re: Please help with jquery
            fdupont

            no, you don't have to include the JS file. It's automatically included once you use the rich:jQuery tag.

            Take a look at your HTML source to be sure it's here.