Primefaces p:ajaxStatus 用于非 ajax 请求
我有一些请求不能是 ajax 请求,有什么办法仍然可以将 p:ajaxStatus 组件用于非 ajax 请求。
I have some requests that can't be ajax requests, is there any way to still use the p:ajaxStatus component with non-ajax requests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这有点晚了,但我基本上做了你所说的。目标是在非 ajax 请求上显示动画 gif 我使用此函数来打开 ajaxStatus 显示。我的 p:ajaxStatus 的 id 为“ajaxStatus”:
现在您只需确保在非 ajax 请求之前调用该函数:
This is a bit late, but I did basically what you're talking about. The goal was to display the animated gif on non-ajax requests I used this function to turn on the ajaxStatus display. My p:ajaxStatus has an id of "ajaxStatus":
Now you just need to make sure you call that function before the non-ajax request:
非ajax请求完全重新加载整个页面。因此,您不能直接使用
p:ajaxStatus
来指示非 ajax 请求正在进行中。如果您的请求导致页面导航,则无需使用
p:ajaxStatus
。否则,您可以将 ajax 请求与p:ajaxStatus
结合起来。不久p:ajaxStatus 不能用于显示非ajax 请求的状态。
Non-ajax requests completely reload the whole page. So you can't literally use
p:ajaxStatus
to indicate that a non-ajax request being in progress.If your request results in page navigation, then there is no use of
p:ajaxStatus
. Otherwise you could couple up the ajax request withp:ajaxStatus
.Shortly p:ajaxStatus can not be used to show the status of non ajax request.