Dojo Error: 'dijit/Dialog' hide

3275
5
Jump to solution
01-06-2016 09:42 AM
JerryGarcia
Occasional Contributor II

I get a JS error when a "hide" a dialog.

See the attached error message.

I appreciate any help.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

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.

View solution in original post

5 Replies
KenBuja
MVP Esteemed Contributor

Can you post your code that gives you this error?

0 Kudos
JerryGarcia
Occasional Contributor II
    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();
        }
0 Kudos
KenBuja
MVP Esteemed Contributor

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.

0 Kudos
JerryGarcia
Occasional Contributor II

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.

0 Kudos
JoelBennett
MVP Regular Contributor

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.