I have a Primefaces datagrid with a bunch of togglable panels.
These panels are updated by an ajax poll.
I would like to refresh the panels without losing their toggle status.
The updateNodes method just ask for new values and return the value object used by the datagrid...
Here is my code:
<h:form id="server_node_form">
<p:poll interval="10" listener="#{serverNodesView.updateNodes}" update="nodeDataGrid" />
<p:dataGrid var="node"
value="#{serverNodesView.dragoNodeGroup.dragoNodes}" columns="3"
layout="grid" rows="10" paginator="false" id="nodeDataGrid" >
<f:facet name="header">
Estados de los nodos del servidor
</f:facet>
<p:panel toggleable="true" collapsed="true"
toggleTitle="Información detallada del nodo">
<f:facet name="header">
<p:panelGrid columns="2" layout="grid"
styleClass="ui-panelgrid-blank"
columnClasses="ui-grid-col-3,ui-grid-col-9">
<p:graphicImage
name="images/server_#{node.status.toLowerCase()}.png" width="64"
height="64" />
<p:panelGrid columns="1" styleClass="ui-panelgrid-blank">
<h:outputText value="#{node.hostname}"
style="font-weight: bold; font-size: 120%" />
<h:outputText value="#{node.ip}: #{node.status}"
style="font-weight: bold; font-size: 120%" />
<h:outputText value="#{node.alias}"
style="font-weight: bold; font-size: 90%" />
</p:panelGrid>
</p:panelGrid>
</f:facet>
<p:panelGrid columns="2" layout="grid">
<p:outputPanel>
<h:panelGrid columns="2">
<h:outputText value="CPU (utilizada):" />
<h:outputText value="#{node.cpuUsed}" />
<h:outputText value="RAM (utilizada):" />
<h:outputText value="#{node.ramUsed}" />
</h:panelGrid>
</p:outputPanel>
<p:outputPanel>
<h:panelGrid columns="2">
<h:outputText value="ETH1 (entrada):" />
<h:outputText value="#{node.net1in}" />
<h:outputText value="ETH1 (salida):" />
<h:outputText value="#{node.net1out}" />
</h:panelGrid>
</p:outputPanel>
</p:panelGrid>
</p:panel>
</p:dataGrid>
</h:form>