title: How to update PrimeFaces datatable using poll with updated toggled columns
body: <p>I've been working on a jsf project(using primefaces 5.2). I've a datatable which gets updated using a poll in every 10 seconds.I also have a column toggler. Everything is working fine but the only problem is that when poll updates the datatable it again adds all the columns to the table.Is there some way to restrict datatable to only show the selected toggled columns only even after poll update.</p>
  
  <p><strong>Here is My xhtml code</strong></p>
  
  <pre><code>&lt;h:form rendered="#{bean.value!=null}"  &gt;
  
          &lt;p:dataTable id="tab" var="var" value="#{bean.value}" &gt;
  
                       &lt;f:facet name="header"&gt;
                          Header for dataTable
                          &lt;p:commandButton style="float:right" id="toggler" type="button" value="Columns"  icon="ui-icon-calculator" /&gt;
                          &lt;p:columnToggler datasource="tab" trigger="toggler" /&gt;
  
  
                       &lt;/f:facet&gt;
          &lt;p:column&gt;
                  &lt;f:facet name="header"&gt;&lt;h:outputText value="Start"/&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{var.startTime}"&gt;
                      &lt;f:convertDateTime pattern="dd.MM.yyyy" /&gt;
                  &lt;/h:outputText&gt;
              &lt;/p:column&gt;
  
              &lt;p:column&gt;
                  &lt;f:facet name="header"&gt;&lt;h:outputText value="End"/&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{var.endTime}" &gt;
                      &lt;f:convertDateTime pattern="dd.MM.yyyy"  /&gt;
                  &lt;/h:outputText&gt;
              &lt;/p:column&gt;
  
              &lt;p:column&gt;
                  &lt;f:facet name="header"&gt;&lt;h:outputText value="Name"/&gt;
                  &lt;/f:facet&gt;
                  &lt;h:outputText value="#{var.name}" &gt;
  
                  &lt;/h:outputText&gt;
              &lt;/p:column&gt;
  
              &lt;/p:dataTable&gt;
  
              &lt;p:poll interval="10"  update="tab" /&gt;
    &lt;/h:form&gt;
  </code></pre>