How to check if the Dojo dialog is loaded?

I run a function that should close the Dojo dialog if it is loaded. How to check if the Dojo dialog works? I use pure JavaScript and check by id if it is undefined?

if (dijit.byId("blah") !== undefined) { 
     destroyRecursive dijit;
}

Or I use a property of a dialog object, for example:

isFocusable method
isLoaded property
+5
source share
2 answers

The dialog provides two properties that you can check: isLoadedand open. Digging through the code, you will find the following descriptions:

  • open: True if a dialog is currently displayed.
  • isLoaded: , ContentPane , ( href ), attr ('content',...)/attr ('href',...) False, , ContentPane href.

, :

var dialog = dijit.byId("blah");
if( dialog.open ) {
    dialog.destroy();
}
+4

?

/ , :

var dialog = dijit.byId('blah');
if (dialog) {
  if (dialog.open) {
    dialog.hide();
  }
  else {
     dialog.show();
  }
}

, :

var dialog = dijit.byId('blah');
dialog.destory();

, destroy , destroy, - dijit.layout.ContentPane.

+1

All Articles