Code: Select all
<p:ajaxStatus onstart="showStatusDialog();" onsuccess="hideStatusDialog();"/>
<p:dialog
modal="true"
widgetVar="statusDialog"
header="Please Wait"
draggable="false"
closable="false"
resizable="false">
<p:graphicImage value="/images/ajaxloadingbar.gif"/>
</p:dialog>
Code: Select all
<script type="text/javascript">
//http://www.freeformatter.com/xml-escape.html unescape functions.
var loadingDelay = 3000;
var interval;
function showStatusDialog() {
var currentUrl = window.location.href.toString();
if (currentUrl.indexOf('index') == -1 && currentUrl.indexOf('showProcessingJobs') == -1) {
interval = setInterval(function() {
loadingDelay-=1000;
if (loadingDelay <= 0) {
//NEED THIS in HERE
// İF AJAXSTATUS.STATUS == STILL LOADING {
PF('statusDialog').show();
clearInterval(interval);
//}
}
}, 1000);
}
}
function hideStatusDialog() {
clearInterval(interval);
PF('statusDialog').hide();
}
</script>
I need to understand that ajaxStatus is stoped/finished after 3second. So i wont show it if its not.