title: Primefaces how to update content in a dialog and keep the dialog centered?
body: <p>I have a dialog that contains no content on page load and I'm dynamically setting the content of a dialog box based on the link that a user clicks on.</p>
  
  <pre><code>&lt;p:dialog widgetVar="dlg" modal="true" id="dialog"&gt;
      &lt;p:panel id="fullArticle"&gt;
          &lt;h:outputText value="#{content.newsArticle}" escape="false" /&gt;
      &lt;/p:panel&gt;
   &lt;/p:dialog&gt;
  ...
  ...
  &lt;p:commandLink value="Read more" actionListener="#{content.getFullArticle}" onclick='dlg.show();' update=":fullArticle"&gt;
      &lt;f:attribute name="contentId" value="#{news.contentId}" /&gt;
  &lt;/p:commandLink&gt;
  </code></pre>
  
  <p>The problem i'm having is that when you click the "Read More" link, it shows the dialog, but the dialog is not centered on the page. If i change the udpate attribute on the commandLink to <code>update=":dialog"</code>, the dialog flashes as if it's opening and then closing right away. </p>
  
  <p>How can I update the dialog and have it be centered with dynamic content?</p>