if p:ajaxStatus should shown if process takes more than 3sec

UI Components for JSF
Post Reply
tayfun
Posts: 16
Joined: 13 Aug 2014, 10:56

31 Mar 2015, 08:16

I have ajaxStatus like this,

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>
and my js function is

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>
it shows himself after 3second and not disapearing.

I need to understand that ajaxStatus is stoped/finished after 3second. So i wont show it if its not.
IDEA 14.0.2
Java 1.6.0_45
Weblogic 12.1.3
Primefaces 5.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests