dojo dialog position
I have an iFrame which has a dijit.Dialog. Since thi开发者_运维百科s iframe is small in width and height, I was wondering if I could place this dialog in the parent window somehow. I tried to do:
var parent_pane = parent.dijit.byId("testpane"); //testpane is in the parent window
dijit.byId("linkedResourcePopup").placeAt(parent_pane);
dijit.byId("linkedResourcePopup").show();
This gives me a javascript error in firebug:
_16c.appendChild is not a function
Is this possible.? Thanks for any help.
You are getting this error because parent.dijit.byId("testpane").appendChild
is not a function.
You need to pass a DOM node to placeAt
. You can access the parent widgets node via parent_pane.domNode
.
placeAt receives a domNode according to:
dojo.place(node, refNode, pos);
node: Can be a String or a DOM node.
refNode: Can be a string (interpreted as an id of a DOM node) or a DOM node.
pos: Optional argument. Can be a number or one of the following strings: “before”, “after”, “replace”, “only”, “first”, or “last”. If omitted, “last” is assumed.
I think what you should do is:
var parent_pane = parent.dijit.byId("testpane"); //testpane is in the parent window
dijit.byId("linkedResourcePopup").placeAt(parent_pane.domNode);
dijit.byId("linkedResourcePopup").show();
精彩评论