title: Trigger JavaScript action after Datatable is loaded
body: <p>In a <code>JSF 2.1</code> + <code>PrimeFaces 3.2</code> web application, I need to trigger a JavaScript function after a <code>p:dataTable</code> is loaded. I know that there is no such event in this component, so I have to find a workaround.</p>
  
  <p>In order to better understand the scenario, on page load the dataTable is not rendered. It is rendered after a successful login:</p>
  
  <pre><code>&lt;p:commandButton value="Login" update=":aComponentHoldingMyDataTable" 
                                      action="#{loginBean.login}" 
                                      oncomplete="handleLoginRequest(xhr, status, args)"/&gt;
  </code></pre>
  
  <p>As you can see from the above code, I have a JavaScript hook after the successful login, if it can be of any help. The <code>update</code> attribute forces the dataTable's rendered attribute to revaluate:</p>
  
  <pre><code>&lt;p:dataTable  var="person" value="#{myBean.lazyModel}" rendered="#{p:userPrincipal() != null}" /&gt;
  </code></pre>
  
  <p>After the datatable is loaded, I need to run a JavaScript function on each row item, in order to subscribe to a <a href="http://cometd.org/" rel="nofollow">cometD</a> topic.</p>
  
  <p>In theory I could use the <code>oncomplete</code> attribute of the login Button for triggering a property from <code>myBean</code> in order to retrieve once again the values to be displayed in the dataTable, but it doesn't seem very elegant. </p>
  
  <p>The JavaScript function should do something with the <code>rowKey</code> of each row of the dataTable: </p>
  
  <pre><code>function javaScriptFunctionToBeTriggered(rowKey) {
      // do something
  }
  </code></pre>