GlideDialogWindow & ShowLoadingDialog

Daryll Conway
Giga Guru

I'm trying to implement a loading pop up using both the GlideDialogWindow & the ShowLoadingDialog as below...

showLoadingDialog();

  var loadingDialog = new GlideDialogWindow("dialog_loading", true);

  loadingDialog.setTitle('Loading CIs please wait');

  loadingDialog.render();

// Then later in the client script ...

addLateLoadEvent(function(){

  hideLoadingDialog();

  loadingDialog.destroy();

  });

The GlideDialogWindow() works in firefox but neither work in IE or Chrome (this was the reason for adding the showLoadingDialog())

Has anyone else experienced this and found a work around?

1 ACCEPTED SOLUTION

hakan_semerci
ServiceNow Employee
ServiceNow Employee

Browser engines loads the pages in different orders and execute onload client script differently. It is better to use a flag to hide difference and check for that flag. Here is a sample:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19

var loadingFlag = true; var loadingDialog = new GlideDialogWindow("dialog_loading", true);   loadingDialog.setTitle('Loading CIs please wait');   loadingDialog.setWidth("500");   loadingDialog.render();  


closeDialog();


execute_log_action();


function execute_log_action() { loadingFlag = false; }; function closeDialog(){ if (!getCIsDone) { setTimeout(closeDialog, 500); } else { loadingDialog.destroy(); } }






View solution in original post

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Daryll,



You may find the below link helpful.


https://community.servicenow.com/thread/173235


Thanks Pradeep, but this relates to ui pages and I'm just using a client script to generate this on a change_request form.



Interestingly though when I try the GlideWindow_example for the GlideDialogWindow (as image below) it works fine in all browsers.


Capture.PNG


I'm a little confused as to why it works here and not in my script !?


hakan_semerci
ServiceNow Employee
ServiceNow Employee

Browser engines loads the pages in different orders and execute onload client script differently. It is better to use a flag to hide difference and check for that flag. Here is a sample:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19

var loadingFlag = true; var loadingDialog = new GlideDialogWindow("dialog_loading", true);   loadingDialog.setTitle('Loading CIs please wait');   loadingDialog.setWidth("500");   loadingDialog.render();  


closeDialog();


execute_log_action();


function execute_log_action() { loadingFlag = false; }; function closeDialog(){ if (!getCIsDone) { setTimeout(closeDialog, 500); } else { loadingDialog.destroy(); } }






Hello Hakan,



What is "getCIsDone"? an event? what would be the equivalent for change request form loads?