Java 如何在datagrid中使用轮询安全地切换primefaces面板
在datagrid中切换某些面板时出现问题:Java 如何在datagrid中使用轮询安全地切换primefaces面板,java,jsf,jsf-2,primefaces,Java,Jsf,Jsf 2,Primefaces,在datagrid中切换某些面板时出现问题: <h:form id="formxy"> <p:panel id="panelxy" header="xy"> <p:focus /> <p:dataGrid var="page" value="#{xyViewBean.xyPages
<h:form id="formxy">
<p:panel id="panelxy" header="xy">
<p:focus />
<p:dataGrid var="page" value="#{xyViewBean.xyPages}" columns="1" id="grid" paginator="false">
<p:column>
<p:panel header="#{page.name}" style="text-align:left" toggleable="true" closable="false" toggleSpeed="500" collapsed="#{page.verifiedBy!=null}" >
<h:panelGrid>
<h:column>
<p:inputText value="${page.url}" required="true" label="text" size="60" disabled="false" onclick="poll.stop()" onfocus="poll.stop()" onblur="poll.start()"/>
<p:commandButton value="xy" update="grid" actionListener="#{xyViewBean.handleClose}">
<f:attribute name="xyPage" value="${page}" />
</p:commandButton>
</h:column>
</h:panelGrid>
</p:panel>
</p:column>
</p:dataGrid>
<p:poll interval="3" widgetVar="poll" update="grid" actionListener="#{xyViewBean.finishedListener}"/>
正如您所看到的,折叠与否的状态是动态的。单击xy按钮执行handleClose actionListener,设置“verifiedBy”字段。因此,该面板应折叠。此外,comandbutton会更新完整的数据网格—不会发生任何情况。重新加载页面会显示面板已折叠。所以我认为它会起作用,但三秒钟后primefaces民意测验再次更新数据网格,面板不再折叠。所以民意测验更新的面板忽略了折叠属性?!有什么想法吗
primefaces:2.2.1试试看
<p:commandButton value="xy" update="formxy:grid" />
如果不起作用,您可以尝试额外的: 在第一个身份证之前。这似乎有效
<p:commandButton value="xy" update=":formxy:grid" />
谢谢你的回答,但这并没有改变什么。我认为命令按钮和轮询中的更新都可以正常工作,但是当轮询和命令按钮更新gridOk时,“collapsed=“#{page.verifiedBy!=null}”被忽略,您可以尝试使用update=“formxy:panelxy”更新面板吗?不幸的是,它仍然是一样的。仅刷新浏览器会折叠面板,在轮询按照您的建议更新面板后,面板不会折叠anymore@cagatay-civici使用“渲染”而不是“折叠”效果很好。面板消失了。有什么想法吗?