title: How to trigger component refresh from javascript in primefaces?
body: <p>Is it possible to update a PrimeFaces component from javascript so that it would be force to refresh?</p>
  
  <p>I am making an ajax save call using this button in a dialog.
  I have attached my custom javascript  on the oncomplete event.</p>
  
  <pre><code>&lt;p:growl life="1500" id="showmessage"/&gt;
  &lt;p:dialog id="addMemberDialog" widgetVar="addMemberDlg"&gt;
      &lt;!-- More Code --&gt;
      &lt;p:commandButton value="Save"
          actionListener="#{memberManagedBean.save}"
          oncomplete="handleSaveNewMember(xhr, status, args)"
          update=":memberListForm:membersTable createupdateform "
          process="@form" /&gt;
  &lt;/p:dialog&gt;
  </code></pre>
  
  <p>..during save button, I am adding a message here to display it to the client using the growl component.</p>
  
  <pre><code>public void save(ActionEvent event) {
      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
              "Successfuly Add user", "Successfuly Add user");
      FacesContext.getCurrentInstance().addMessage(null, message);
  
  }
  </code></pre>
  
  <p>My problem is, how can I sequence the UI such that, i should hide the dialog first before the growl component could show the meesage?</p>
  
  <pre><code>function handleSaveNewMember(xhr, status, args) {
      addMemberDlg.hide();
      //update the growl after the dialog was hidden?
  }
  </code></pre>
  
  <p>What's happening is that the growl component is displayed alongside the dialog at the same time.</p>
  
  <p>Thanks.</p>