title: Attach Jquery events to JSF data tables
body: <p>Since we can apply JQuery to any JSF rendered components, as in the following question</p>
  
  <p><a href="https://stackoverflow.com/questions/10515384/jsf-to-jquery-component-integration">JSF to JQuery Component Integration</a></p>
  
  <p>After having tried that, it did work I can successfully integrate JQuery into JSF, but the problem is that whenever I re-render the h:dataTable for instance, JQuery stops working, 
  -I'm using RichFaces and the a4j, by the way-.</p>
  
  <p>For example, I have a data table as follows</p>
  
  <pre><code>&lt;h:dataTable id="someDataTable" value="#{backingBean.someDataModel}" var="item" styleClass="table"&gt;
     &lt;h:column&gt;
        &lt;h:outputText value="#{item.text}"/&gt;
     &lt;/h:column&gt;
  &lt;/h:dataTable&gt;
  </code></pre>
  
  <p>and I have a button that when clicked re-renders the dataTable, and repopulate it with new data.</p>
  
  <pre><code>&lt;a4j:commandButton value="Click" reRender="someDataTable"/&gt;
  </code></pre>
  
  <p>and not to forget I have this script in the page</p>
  
  <pre><code>&lt;script&gt;
    jQuery.noConflict();
     jQuery(document).ready(function () {
        jQuery('.table').dataTable({
      "bSort": false}); 
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Now when the page is first loaded, sorting works fine, but whenever I click the button to re-render the table, the table is successfully populated with the new data from the backing bean, but the sorting doesn't work anymore.</p>
  
  <p>From what I guess, I think this might has something to do with the </p>
  
  <pre><code>jQuery(document).ready()
  </code></pre>
  
  <p>which applies the </p>
  
  <pre><code>jQuery.('.table').dataTable(); 
  </code></pre>
  
  <p>only when the document is ready, so I was wondering if there's some events in jQuery that I can attach to the dataTable re-render event, as I'm no guru at JQuery or JS.</p>