I get a JS error when a "hide" a dialog.
See the attached error message.
I appreciate any help.
Thanks!
Solved! Go to Solution.
The stack trace is hard to interpret, but it could possibly show the call to hide being in the same call stack as the call to show. It may be necessary to show some of the additional code involving this dialog, so we can see its full life cycle.
Since the dialog cannot be closed by the user, it appears that it must be closed automatically. What triggers the dialog to close (e.g. a window.setTimeout, etc)? If the call to open and hide are too close together (i.e. the call to hide finishes before the call to show finishes), there may be a synchronization issue going on.
Can you post your code that gives you this error?
var authorizeDialog = new Dialog({ | ||
title: AppState.AppName, | ||
content: '<center>Authorizing...</center>', | ||
style: 'width: 300px; padding: 10px' | ||
}); | ||
domStyle.set(authorizeDialog.closeButtonNode, { display: 'none' }); | ||
authorizeDialog.closable = false; | ||
authorizeDialog.show(); |
////////////
if ((authorizeDialog) && (authorizeDialog.open)) { | ||
authorizeDialog.closable = true; | ||
authorizeDialog.hide(); | ||
} |
Where do you have that second code fragment in relation to where you instantiate the variable "authorizeDialog"? Have you checked if the scope is correct on the variable? If you create the dialog in one function and try to do something with it in another function, it wouldn't work correctly the way you have it. You'd have to declare "authorizeDialog" as a global variable or pass it to the separate function.
The scope is correct. The dialog object is valid and does 'hide'. But, the JS error is thrown. The error is an annoyance. I'd like to fix it since I have a JS error every time my app loads.
The stack trace is hard to interpret, but it could possibly show the call to hide being in the same call stack as the call to show. It may be necessary to show some of the additional code involving this dialog, so we can see its full life cycle.
Since the dialog cannot be closed by the user, it appears that it must be closed automatically. What triggers the dialog to close (e.g. a window.setTimeout, etc)? If the call to open and hide are too close together (i.e. the call to hide finishes before the call to show finishes), there may be a synchronization issue going on.