I'm trying to programmatically create a dijit.Dialog from a DOM node but it doesn't seem to be working. The docs imply that this is possible, but when I call dialog.setContent(domNode), and then display the dialog, the contents of the DOM tree rooted at the DOM node is not displayed in the dialog. I tried dialog.domNode.appendChild(domNode), and the contents of the DOM tree was rendered in the dialog, but the button area was rendered above the content area and the entire dialog was semi-transparent. Can someone let me know the correct way to do this?
Thanks,
--bb

I just did a few quick (and
I just did a few quick (and simple) tests of the above, using the test_Dialog.html file. Seemed to work fine.
If you crunch down your html file to a very small, but complete, html file and post it here, in a reply, between code tags, we'll see if we spot anything.
your html page code goes here
</code>
it should work
setContent(domNode) should work for the Dialog. I've done it before myself. The other approach is valid, though you are appending the info to the wrong node. In the Dialog template (and this applies to most templated widgets with "content") the actual content goes into a node called containerNode.
html:
and to make it:
var node = dojo.byId("foobar"); var dialog = new dijit.Dialog({ title:"made it" }); dialog.startup(); // both of these lines should work: dialog.containerNode.appendChild(node); // or dialog.setContent(node);as I'm sure you know, you could create it _from_ the node, and let the Dialog handle the content. Using the same html node above:
var dialog = new dijit.Dialog({ title:"made it" },"foobar"); // use node byId("foobar") dialog.startup();Thanks for the response. I
Thanks for the response. I tried dialog.containerNode.appendChild(node) and that worked. Appreciate the help!
XML within Dialog is not working for me
Hi,
I tried both options but not able to make it work. I want to show the XML to the user and I am pasting the code below. When I step through debugger, I see that the xml doc is created.
If I use setContent, the popup shows 'undefined' if I use the other, I am getting the following error
'Node cannot be inserted at the specified point in the hierarchy'
var inXml = '000000pattabitest1230'; var mydom = dojox.data.dom.createDocument(inXml, "text/xml"); function junk(){ var dialog = dijit.byId('dialog1'); //it is already defined and parsed. dialog.setContent(inXml); dialog.show(); }Could you please spot the error?
Thanks
Shouldn't it be
Shouldn't it be setContent(mydom)?