I'm Having Trouble Placing A Dojo Widget In The Page
I've got a simple widget: define(['dojo/_base/declare', 'dijit/_WidgetBase', 'dojo/dom-construct'], function(declare, WidgetBase, domConstruct){ return declare('gijit.workflow
Solution 1:
At the moment you invoke window.body()
the DOM has not been parsed yet and it therefore returns undefined
. Require dojo/domReady!
plugin as the last module loading:
require([
"dojo/dom",
"gijit/workflow/debug/combi",
"dojo/parser",
"dojo/_base/window",
"dojo/domReady!"// ==> wait for the DOM to be ready
], function(dom, combi, parser, win) {
var widget = newcombi();
widget.placeAt(win.body());
widget.startup();
});
Please note, that as a best practice I would recommend not to hide window
object by assigning dojo/_base/window
module into a local window
variable, use win
instead.
Post a Comment for "I'm Having Trouble Placing A Dojo Widget In The Page"