wait seems not waiting...

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

wait seems not waiting...

#1

Postby t4nu » Fri Jun 17, 2016 1:16 pm

Hi,
I want to make the user aware that something is going on when he click the button, I want make the screen to go dim and the waiting cursor shown.

So, in the HTML Element of the button I put something like below in the click event:

Code: Select all

var ok2Continue = 0;
var newDate    = $("#clBTUntil").val();
var newChecked = $(".clIsTBA").is(":checked");
var docNo      = $("#clAdvanceNo").text();

try 
  {
     $("#clPerDinReqPage").addClass("wait"); //set cursor
     ok2Continue = $eb.executeFunction("UntilDateChanged", [newDate, newChecked, docNo]);

     if &#40;ok2Continue < 0&#41;
     &#123;
        if &#40;ok2Continue == -1&#41;
          alert&#40;"Updating to database, failed!"&#41;;
        else
          alert&#40;"Cannot send notification email!"&#41;;
     &#125;
  &#125; 
  finally 
  &#123; 
     $&#40;"clPerDinReqPage"&#41;.removeClass&#40;"wait"&#41;; //finish 
  &#125;

  return true;

and the content of the wait class is like this:

Code: Select all

.wait
&#123;
	  cursor&#58; wait;
    position&#58;fixed;
    top&#58;0;
    bottom&#58;0;
    left&#58;0;
    right&#58;0;
    background-color&#58;#fff;
    opacity&#58;0.65;
    z-index&#58;1001;	
&#125;

but when the user clicked the button, the screen is not change, only change when the alert triggered.

What should I do to fix it?

Thanks in advance.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

[SOLVED] wait seems not waiting...

#2

Postby t4nu » Thu Jun 23, 2016 3:09 am

Hi,
Just in case there is somebody in the same condition with me, here is what I did to get what I want:

Code: Select all

var ok2Continue = 0; 
var newDate    = $&#40;"#clBTUntil"&#41;.val&#40;&#41;; 
var newChecked = $&#40;".clIsTBA"&#41;.is&#40;"&#58;checked"&#41;; 
var docNo      = $&#40;"#clAdvanceNo"&#41;.text&#40;&#41;; 
var lContinue = false;

     $.when&#40;$&#40;"#clPerDinReqPage"&#41;.addClass&#40;"wait"&#41;&#41;.then&#40;
         function&#40;&#41;
         &#123; 
              ok2Continue = $eb.executeFunction&#40;"UntilDateChanged", &#91;newDate, newChecked, docNo&#93;&#41;; 

              if &#40;ok2Continue < 0&#41; 
              &#123; 
                  if &#40;ok2Continue == -1&#41; 
                     alert&#40;"Updating to database, failed!"&#41;; 
                  else 
                     alert&#40;"Cannot send notification email!"&#41;; 
              &#125;
              else
                  lContinue = true;
         &#125;&#41;;

  return lContinue; 

0 x


Who is online

Users browsing this forum: No registered users and 13 guests