Cannot create dijits via dojo.NodeList.instantiate -
I'm trying to use the dijits with the dojo.NodeList.instantiate
method That changes the existing HTML elements and to them in DIG when the DOM loads.
instantiate
The API reference can be found for the method.
The following example, which calls the instantiate
method in the dojo.addOnLoad
method, with two ContentPane
examples BorderContainer
should be created, but the DIVs remain intact when they start, and the documents are not created:
& lt ;! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Transcription // N http: // www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; & Lt; Title & gt; Digit Test & lt; / Title & gt; & Lt; Style type = "text / css" & gt; @Import "Doorout / Digit / Themes / Tundra / Tundra CSS"; @import "dojoroot / dojo / resources / dojo.css"; & Lt; / Style & gt; & Lt; Script type = "text / javascript" src = "dojoroot / dojo / dojo.js" djConfig = "parseOnLoad: true" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Dojo.require ("dijit.layout.BorderContainer"); Dojo.require ("dijit.layout.ContentPane"); Dojo.addOnLoad (function (dojo.query ("# divOuter"). (Dijit.layout.BorderContainer, {Design: 'Sidebar', Gutter: false}); dojo.query ("# divMiddle "). (Dijit.layout.ContentPane, {region: 'center'}), dojo.query (" # divrayight "). (Dijit.layout.ContentPane, {region: 'right', splitter: true} );}); & Lt; / script> & lt; / head> gt; body & gt; & lt; div id = "divouter" style = "width: 400px; height: 300px" & gt; ; & Lt; div id = "divMiddle" & gt; mid box & lt; / div & gt; & lt; div id = "divrayight" & gt; right box & lt; / div & gt; & lt; / div & Gt; & lt; / body & gt; & lt; / html>
I have the above code in both Firefox 3.5 and Internet Explorer I have tried and failed to present both the Dadget. If I specify a standard HTML attribute in a property object (such as style
attribute), then this style change is displayed correctly, This indicates that the object is being read:
// The red border appears when using this example dojo.query ("# divrayight"). Instantiate (dijit.layout.ContentPane, {region: 'right', splitter: true, style: 'border: 1px solid red'});
The following HTML (using dojoType
and other attributes attributes) works fine - Frontline and content pages are displayed properly in both browsers:
& lt; Div dojoType = "dijit.layout.BorderContainer" design = "sidebar" gutters = "false" style = "width: 400px; height: 300px" & gt; & Lt; Div dojoType = "dijit.layout.ContentPane" area = "center" & gt; Mid box & lt; / Div & gt; & Lt; Div dojoType = "dijit.layout.ContentPane" field = "true" splitter = "true" style = "width: 200px;" & Gt; Right box & lt; / Div & gt; & Lt; / Div & gt;
Could someone please tell me why the instantiate
example does not work?
I have searched a lot, but I do not think anyone else can find this issue, which means that I can use the instantiate
method correctly I'm not!
Thank you.
After those initializations, those dijits need to make startup calls. Do not do this for dojo.query.instantiate
because it creates an object.
At the bottom of your onload function, add these:
By ('divOuter'). Startup (); Dijit.byId ('divMiddle') startup () .; Dijit.byId ('divRight') startup () .;
Comments
Post a Comment