views:

823

answers:

4

Does anybody know how I can close all modal dialogs created by Dojo ? Apparently there used to be a dojo.popup.closeAll function, but this is no longer available in the latest version of the Dojo API that comes with Spring JS.

+1  A: 

It appears that the only valid way now is to keep track of your dialogs and close them all when needed using hide().

Eugene Lazutkin
+2  A: 

That's right.... the reason that method isn't there anymore is that from 1.0, whoever opens a popup is in charge of closing it. It's an architecture change I made.

Most widgets (like Menu) monitor when they've been blurred, and then close their child popup. So, you could probably get the effect you wanted by switching focus to the document itself, or to some random node. Of course that's a workaround.

Bill

OK. Unfortunately, that really doesn't help my situation, but that's not your fault. Thank you kindly for your answers guys, it's much appreciated.
Alex Marshall
+2  A: 

This will find all literal Dialogs in a page and hide them:

dijit.registry.filter(function(w){ 
    return w && w.declaredClass == "dijit.Dialog" 
}).forEach(function(w){ 
    w.hide(); 
});
A: 

I don't know if this is of any use, but I tend to use only one dialog for each page (since it is modal). All the dialogs' content is xhrGot from the server, and I spend the entire dojo-time within a page's lifecycle recycling again and again the same dialog, merely changing its attributes: its href and its title. I find this works as well as having several dialogs.

pierdeux