0

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>
Cœur
  • 37,241
  • 25
  • 195
  • 267
HeartATech
  • 57
  • 1
  • 2
  • 12
  • You mean something like this? http://blog.primefaces.org/?p=3341. And it is better to use 'push' in my opion, to only update the client side when there are real changes... More performant I think – Kukeltje Apr 25 '16 at 08:26
  • Oh wow. Thanks.That was quick.How could I not see that. – HeartATech Apr 25 '16 at 08:47
  • @Kukeltje Can you please help me is [this](http://stackoverflow.com/questions/36837997/cant-close-columntoggler-after-poll-updates) – HeartATech Apr 25 '16 at 15:03

0 Answers0