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.
Here is My xhtml code
<h:form rendered="#{bean.value!=null}" >
<p:dataTable id="tab" var="var" value="#{bean.value}" >
<f:facet name="header">
Header for dataTable
<p:commandButton style="float:right" id="toggler" type="button" value="Columns" icon="ui-icon-calculator" />
<p:columnToggler datasource="tab" trigger="toggler" />
</f:facet>
<p:column>
<f:facet name="header"><h:outputText value="Start"/>
</f:facet>
<h:outputText value="#{var.startTime}">
<f:convertDateTime pattern="dd.MM.yyyy" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header"><h:outputText value="End"/>
</f:facet>
<h:outputText value="#{var.endTime}" >
<f:convertDateTime pattern="dd.MM.yyyy" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header"><h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{var.name}" >
</h:outputText>
</p:column>
</p:dataTable>
<p:poll interval="10" update="tab" />
</h:form>