[Dojo-interest] dijit.Dialog

peter e higgins dante at inpdx.net
Sun Dec 16 18:15:46 UTC 2007


You just have to be careful is all ;) ... inline:

On Sunday 16 December 2007, Daniel wrote:
> I tried the following:
>
> var dialog = document.createElement("div");
> dojo.byId('BodyContent').appendChild(dialog);
> var dialog = new dijit.Dialog({
> 	title: "Hello world"
> }, dialog);
> dialog.setContent("Foo!");
> dialog.startup();
> dialog.show();

you are mucking with the var dialog twice there, and weird things could happen 
(in the srcNodeRef var).

try:

var node = dojo.doc.createElement('div')
var dialog = new dijit.Dialog({ title:"yo." },node);
dialog.startup();

then, Dialog inherits from ContentPane, which if the API pages worked it would 
try to make clear, but ContentPane has a few methods:

.setHref and .setContent

so dialog.setContent("this is a test"); dialog.show(); 
show work out.

you can dialog.setHref("foo.html"); too

I'm sure you also have dojo.require("dijit.Dialog") but wasn't mentioned in 
the example.

There is a programatic example in the dijit/tests/test_Dialog.html file, but 
it uses static text on the page, but seeing it's various uses programatically 
(and inspecting contentpane, which is a foundation for a _lot_ of "content" 
widgets) may be helpful.

Regards,
Peter Higgins


More information about the Dojo-interest mailing list