问题描述
我使用的是带有 JSF 2.0 的 Primefaces 3.2.
I'm using Primefaces 3.2 with JSF 2.0.
我正在使用
<p:commandButton action="#{myBackingBean.action}" value="press me" />
这对于ajaxStatus:
And this for ajaxStatus:
<p:ajaxStatus onstart="statusDialog.show();"
onsuccess="statusDialog.hide();"
rendered="#{myBackingBean.ajaxStatusRendered}"
id="ajaxStatusField" />
<p:dialog modal="true" widgetVar="statusDialog"
header="#{myBackingBean.ajaxStatusHeader}"
rendered="#{myBackingBean.ajaxStatusRendered}" id="ajaxPanel"
draggable="false" closable="false">
<p:graphicImage value="./images/ajaxloader.gif" />
</p:dialog>
我在同一页面上也有很多其他 primefaces 组件,但我只希望 p:ajaxStatus 在按下此特定按钮时呈现.有什么好的解决办法吗?ajaxStatus 在每个 ajax 事件上呈现..
I've got lots of other primefaces components also on the same page, but I only want the p:ajaxStatus to render when this specific button is pressed. Any good solution to this? The ajaxStatus renders on every ajax event..
推荐答案
如果你有几个按钮,你可以在它们上设置 global="false"
并保留所需的按钮而不用这个设置.
If you have a few amount of buttons, you could set on them global="false"
and leave the desired button without this setting.
这样所有其他按钮都不会触发 p:ajaxStatus
而所需的按钮会.
This way all other buttons wouldn't trigger the p:ajaxStatus
while the desired button would.
这篇关于ajaxStatus 仅针对特定组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!