title: Primefaces : How to update a grid/table in the parent form from a command button on the child form in a dialog (dialog residing on the parent form)?
body: <p>I want to update the table with id "datatable" by pressing the button with id "updator". The XHTML code is as follows :-</p>
  
  <pre><code>&lt;h:form id="mainForm"&gt;
  
      &lt;p:datatable id = "datatable"&gt; 
  
          ---- columns ----
  
      &lt;/p:datatable&gt;
  
  &lt;/h:form&gt;
  
  &lt;p:dialog widgetVar="dlg" &gt;
  
      &lt;h:form id="subForm"&gt;
  
          various input fields
          ......  
          ......
          &lt;p:commandButton id="updator" actionListener="#{javaBean.updateGrid()}" update="mainForm:datatable" oncomplete="dlg.hide()"/&gt;
  
      &lt;/h:form&gt;
  
  &lt;/p:dialog&gt;
  </code></pre>