title: Primefaces how to toggle a dashboard widget/panel visibility using ajax?
body: <p>I have a dashboard with a considerable number of widgets / panels which are working just fine.</p>
  
  <p>I'm looking for a way to toggle the visibility of a specific one using a commandButton ction listener without having to refresh the page, i.e. via AJAX.</p>
  
  <pre><code>&lt;p:dashboard id="board" model="#{dashboardBean.model}"&gt;
      &lt;!-- iteration code begins --&gt;
      &lt;p:panel id="#{wdgt.code}" header="#{wdgt.title}"&gt;  
          &lt;h:outputText value="One of the dozens of widgets" /&gt;  
      &lt;/p:panel&gt;
      &lt;!-- iteration code ends --&gt;
      &lt;p:panel id="staticWdgtId" header="Static Widget Initially Invisible" visible="false"&gt;
           Some static content
      &lt;/p:panel&gt;
  &lt;/p:dashboard&gt;
  </code></pre>
  
  <p>Then in the backing bean, at some point this action needs to be fired via a commandButton or an actionListener...</p>
  
  <pre><code>public void showTheWidget() {
      DashboardColumn dbc = this.model.getColumn(1);      
      dbc.getWidget(2); // does not get a widget object with a visibility attribute :((
                          // so that I could manipulate such as dbc.getWidget(2).setVisible(true);
  }
  </code></pre>
  
  <p>Any ideas?</p>