如何使用数据网格内的民意调查安全地切换 primefaces 面板
我在切换数据网格中的某些面板时遇到问题:
<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 按钮将执行设置“verifiedBy”字段的handleClose actionListener。因此该面板应该折叠。此外,命令按钮更新完整的数据网格也没有任何反应。重新加载页面显示面板已折叠。所以我认为它会起作用,但三秒钟后,primefaces poll 再次更新数据网格,并且面板不再折叠。那么通过民意调查更新的面板会忽略折叠属性吗?!有什么想法吗?
素面:2.2.1
I have a problem toggling some panels within a datagrid:
<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}"/>
As you can see the status of being collapsed or not is dynamic. Clicking the xy button executes the handleClose actionListener which sets the "verifiedBy" field. Therefore this panel should be collapsed. Also the comandbutton updates the complete datagrid nothing happens. Reloading the page shows the panel collapsed. So i thought it would work, but after three seconds the primefaces poll updates the datagrid again and the panel is not collapsed anymore. So panels being updated by the poll ignore the collapse attribute?! Any idea?
primefaces:2.2.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这不起作用,您可以尝试额外的方法:
在第一个 id 之前。这似乎有效。
In case that did not work, you could try an extra :
before the first id. That seemed to work.
尝试;
Try;