tags:

views:

1114

answers:

1

Is there a way to set a button inside the dojo dialog box and have it close the dialog box it is residing in?

Putting dijits inside of dijits doesn't work, and I can't beleive there isn't a way to do that.

A: 

Sure you can put a dijit widget inside another widget. And in a standard Dojo release there's even a test case Dijit Dialog focus & destroy included that demonstrates closing dialog with a button inside of it. Here's the relevant part:

var btn = new dijit.form.Button({ label: "Close" });
dlg.containerNode.appendChild(btn.domNode);

dojo.connect(btn, "onClick", function(){
    console.log("destroying, while visible"); 
    dlg.destroy();
});
Maine