开发者

Primefaces p:ajaxStatus for non ajax requests

I have some requests that can't be ajax requests, is there any way to still use the p:ajaxStatus component开发者_JAVA技巧 with non-ajax requests.


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":

function startAjaxStatus() { 
  document.getElementById("ajaxStatus_start").style.display='block'; 
  document.getElementById("ajaxStatus_complete").style.display='none'; 
  document.getElementById("ajaxStatus_error").style.display='none'; 
  document.getElementById("ajaxStatus_default").style.display='none'; 
} 

Now you just need to make sure you call that function before the non-ajax request:

<p:commandButton ajax="false" onclick="startAjaxStatus()" ...


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 with p:ajaxStatus.

Shortly p:ajaxStatus can not be used to show the status of non ajax request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜