4 Replies Latest reply on Dec 3, 2009 10:11 AM by Suresh M

    Question about seam:component

    Chuanbao Lu Newbie

      I want to use javascript to select/deselect all the certificate by click the SelectAll checkBox on the header.

      Does anybody know how to reference a component in a dataTable?

      {rich:component('certSelected')} is wrong.

      <rich:dataTable id="certificateList"
                rendered="#{not empty certificateManager.quote.certificates}">
         <f:facet name="header">
              <h:selectBooleanCheckbox id="selectAll" title="Select all/none" 
                        = #{rich:component('selectAll').checked}"/>
         <h:selectBooleanCheckbox id="certSelected" value="#{_cert.selected}">

        • 1. Re: Question about seam:component
          Ingo Jobling Master

          Sounds like a job for <rich:jQuery/>

          • 2. Re: Question about seam:component
            Chuanbao Lu Newbie

            Thank you Ingo. I coded like this. It works good.

               <f:facet name="header">
                  <h:selectBooleanCheckbox id="selectAll" title="Select all/none"/>
               <h:selectBooleanCheckbox id="certSelected" value="#{_cert.selected}"/>
            <rich:jQuery selector="#selectAll" query="click(function() 
                 {selectCerts(null, jQuery(this).attr('checked'));})"/>
            <rich:jQuery selector="input[@id*=certSelected]" name="selectCerts" 
                 timing="onJScall" query="attr('checked',param)"/> 

            • 3. Re: Question about seam:component
              Suresh M Newbie
              I used your code for Select all/unselect. But, it’s thrown JavaScript error. Can you plz explain the second line of <rich:jQuery> and also what is the ‘param’ value?. What should I give instead of param?  Anyone have idea plz tell me.
              • 4. Re: Question about seam:component
                Suresh M Newbie
                I used Jquery like this,It's working fine

                <script type="text/javascript">
                                   var status = this.checked;
                                        this.checked = status

                <rich:column  style="text-align:center" >
                                    <f:facet name="header">
                                         <h:selectBooleanCheckbox id="selectAll"/>
                                    <h:selectBooleanCheckbox value="#{countryList.selectedCountry[countryDAO.code]}" id="selectRow"/>