title: update primefaces dataTable with new rows adding dynamically
body: <p>When I click on the button New <code>&lt;p:commandButton  actionListener="#{ecritureCtrl.newLine}" value="New" update="dataTableSaisiePiece" oncomplete="addRowOnComplete()" ajax="true"/&gt;</code>, a new row is added to my dataTable on only the first click and the page is refreshed. Several cliques except the first were not refreshes the dataTable. So to see my newly added rows, I use the F5 key to refresh my page. Certainly my <code>update="dataTableSaisiePiece"</code> not work or only works rather the first click. </p>
  
  <p>Here is my page home.xhtml :</p>
  
  <pre><code>    &lt;?xml version='1.0' encoding='UTF-8' ?&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:p="http://primefaces.org/ui"&gt;
      &lt;script type="text/javascript"&gt;
              function addRowOnComplete() {
        jQuery('#supercoolnewrow').trigger('click');
      }
      &lt;/script&gt;
          &lt;ui:composition template="/resources/template/all.xhtml"&gt;
              &lt;ui:define name="titre"&gt;Saisie&lt;/ui:define&gt;
  
              &lt;ui:define name="content"&gt;
                  &lt;p:tabView id="ViewPlan"&gt;
  
                      &lt;p:tab id="tab2" title="Saisie 1"&gt;
                          &lt;h:outputScript library="js" name="frenchLocale.js" /&gt;
                                  &lt;h:form id="formPiece"&gt;
                                      &lt;p:panel id="panelSaisie" header="Saisir" style="color: brown;font-size: 15px"&gt;
                                          &lt;h:panelGrid columns="3" &gt;
                                                  &lt;p:outputLabel for="description" value="Description:" &gt;&lt;/p:outputLabel&gt;
                                                  &lt;p:inputText id="description" value="#{ecritureCtrl.description}" required="true" label="Description" maxlength="100" size="75"&gt;  
                                                          &lt;f:validateLength maximum="100" /&gt;  
                                                      &lt;/p:inputText&gt;
                                                      &lt;p:message for="description" /&gt;
  
                                                  &lt;p:outputLabel for="date" value="Date:" &gt;&lt;/p:outputLabel&gt;
                                                  &lt;p:calendar locale="fr" id="date"  required="true" label="Date" value="#{ecritureCtrl.date}" /&gt;  
                                                  &lt;p:message for="date" /&gt;  
  
                                                  &lt;p:outputLabel for="code" value="Code Avant" &gt;&lt;/p:outputLabel&gt;
                                                  &lt;p:inputText id="code" value="#{ecritureCtrl.code}" required="true" &gt;  
  
                                                  &lt;/p:inputText&gt;
                                                  &lt;p:message for="code" /&gt;
  
                                              &lt;/h:panelGrid&gt;
                                          &lt;br/&gt;
                                          &lt;p:dataTable var="line" value="#{ecritureCtrl.lignes}"  id="dataTableSaisiePiece" &gt;
  
                                  &lt;p:column headerText="First Name" style="width:150px"&gt;
                                      &lt;p:inputText value="#{line.intituleCompte}" style="width:100%"/&gt;
                                   &lt;/p:column&gt;  
  
                                  &lt;p:column headerText="Last Name" style="width:150px"&gt;
                                      &lt;p:inputText value="#{line.code}" style="width:100%"/&gt;
  
                                  &lt;/p:column&gt;
  
                              &lt;/p:dataTable&gt;
  
  
                             &lt;/p:panel&gt;
                                      &lt;p:commandButton  actionListener="#{ecritureCtrl.newLine}" value="New" update="dataTableSaisiePiece" oncomplete="addRowOnComplete()" ajax="true"/&gt;
                                     &lt;/h:form&gt;  
  
                              &lt;/p:tab&gt;
  
                      &lt;p:tab id="tab3" title="Saisie 2"&gt;
                      &lt;/p:tab&gt;
  
                  &lt;/p:tabView&gt;
  
              &lt;/ui:define&gt;
          &lt;/ui:composition&gt;
  
      &lt;/html&gt;
  </code></pre>
  
  <p>My ManagedBean:</p>
  
  <pre><code>    @ManagedBean (name = "ecritureCtrl")
      @SessionScoped
      public class EcritureCtrl {
      private List&lt;Avant&gt; lignes = new ArrayList&lt;Avant&gt;();
      Avant unUser;
  
      private String description;
      private Date date;
      private String code;
          public EcritureCtrl() {
              lignes.add(new Avant());
           }
  
          public void newLine(ActionEvent actionEvent){
              lignes.add(new Avant());            
          }
  
      }
  </code></pre>
  
  <p>Could you please help me ?
  Thanks in advance.</p>