title: How to close a p:dialog after a p:commandButton action?
body: <p>I have a <code>p:dialog</code> that shows after a <code>p:dataTable</code> row is clicked. I have a <code>p:commandButton</code> in the  <code>p:dialog</code> and it has an <code>action</code> like this:</p>
  
  <pre><code>&lt;p:commandButton value="Cambiar" action="#{adminUsuarios.cambiarPerfil()}" update="tblUsuarios" /&gt;
  </code></pre>
  
  <p>The method <code>cambiarPerfil()</code>:</p>
  
  <pre><code>public void cambiarPerfil() {
      // More stuff here
      this.listaUsuarios = null; // Clear the list
  }
  </code></pre>
  
  <p>That works fine but <strong>I want to close</strong> the <code>p:dialog</code> after the <code>p:commandButton action</code>.</p>
  
  <p>This is the dialog:</p>
  
  <pre><code>&lt;h:form id="myForm"&gt;
      &lt;!-- More stuff--&gt;
      &lt;p:dialog id="myDialog" widgetVar="editarDialog" header="Editar perfil de usuario #{adminUsuarios.usuarioSeleccionado.id_User}" resizable="false" width="400" showEffect="size" hideEffect="size"&gt;
          &lt;p:commandButton value="Cambiar" action="#{adminUsuarios.cambiarPerfil()}" update="tblUsuarios" /&gt;
      &lt;/p:dialog&gt;
  &lt;/h:form&gt;
  </code></pre>