title: Primefaces 3.5 dialog's 'visible' attribute does update correctly after ajax 'close' event
body: <p>Solution <a href="https://stackoverflow.com/questions/17381652/primefaces-dialog-not-reopening-when-ajax-close-event-listener-included">here</a>. (Showing and hiding <code>dialog</code> from within bean.)</p>
  
  <hr>
  
  <p>I have a <code>dialog</code> and show/hide buttons which works fine. Dialog reads <code>boolean</code> value from backing bean and updates it's <code>visible</code> attribute (which makes it show or hide). Everything works fine until I close dialog using default close button, which fires ajax <code>close</code> event. From that moment on show/hide buttons does not work, or rather dialog does not update it's <code>visible</code> state. It stays closed forever.</p>
  
  <p>I found out that, after ajax event is fired, everything updates correctly except dialog <code>visible</code> attribute. Buttons works fine, they updates backing bean correctly (I can see it in log file), and also dialog panel is updated correctly (I can see correct <code>showDialog</code> value displayed on screen).</p>
  
  <p>I know there are other ways to show/hide dialogs, yet I am really curious what is happening in this case - why it works that way? Is there any way to display dialog by reading visibility value from bean (and what's more important to update bean value when dialog is closing)?</p>
  
  <p>My XHTML:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;h:form&gt;
      &lt;p:commandButton value="show d1" actionListener="#{testBean.enableShowDialog()}" update=":dialogId"/&gt;
      &lt;p:commandButton value="hide d1" actionListener="#{testBean.disableShowDialog()}" update=":dialogId"/&gt;
  &lt;/h:form&gt;
  &lt;p:outputPanel id="dialogId"&gt;
      showDialog value = #{testBean.showDialog}
      &lt;p:dialog header="d1" visible="#{testBean.showDialog}"&gt;
          &lt;p:ajax event="close" listener="#{testBean.disableShowDialog()}" update=":dialogId"/&gt;
          test
      &lt;/p:dialog&gt;
  &lt;/p:outputPanel&gt;
  </code></pre>
  
  <p>And backing bean:</p>
  
  <pre class="lang-java prettyprint-override"><code>@ManagedBean
  @ViewScoped
  public class TestBean implements Serializable {
      private static final Logger LOGGER = LoggerFactory.getLogger("TB");
  
      private boolean showDialog;
  
      public boolean isShowDialog() {
          LOGGER.info("getter isShowDialog={}", showDialog);
          return showDialog;
      }
  
      public void enableShowDialog() {
          showDialog = true;
          LOGGER.info("isShowDialog set to true");
      }
  
      public void disableShowDialog() {
          showDialog = false;
          LOGGER.info("isShowDialog set to false");
      }
  }
  </code></pre>