diff --git a/2021/12/dojo_demo2/app/_base/configRhino.js b/2021/12/dojo_demo2/app/_base/configRhino.js new file mode 100644 index 0000000..078426a --- /dev/null +++ b/2021/12/dojo_demo2/app/_base/configRhino.js @@ -0,0 +1 @@ +// \ No newline at end of file diff --git a/2021/12/dojo_demo2/app/widgets/ChildWidget2.js b/2021/12/dojo_demo2/app/widgets/ChildWidget2.js new file mode 100644 index 0000000..3515df6 --- /dev/null +++ b/2021/12/dojo_demo2/app/widgets/ChildWidget2.js @@ -0,0 +1,16 @@ +define([ + "dojo/parser", + "dijit/_TemplatedMixin", + "dijit/_WidgetBase", + "dojo/_base/declare" +], function(parser, _TemplatedMixin, _WidgetBase, declare, template) { + var widget = declare("app/widgets/ChildWidget2", [_WidgetBase, _TemplatedMixin], { + templateString: "
" + + "ChildWidget!!!" + + "
" + }); + + // parser.parse(); + + return widget; +}); \ No newline at end of file diff --git a/2021/12/dojo_demo2/app/widgets/MainWidget.js b/2021/12/dojo_demo2/app/widgets/MainWidget.js index 13c2fbf..8c61d7e 100644 --- a/2021/12/dojo_demo2/app/widgets/MainWidget.js +++ b/2021/12/dojo_demo2/app/widgets/MainWidget.js @@ -1,14 +1,19 @@ define([ + "require", "dijit/_TemplatedMixin", + "dijit/_WidgetsInTemplateMixin", "dijit/_AttachMixin", "dijit/_WidgetBase", - "dojo/_base/declare" -], function(_TemplatedMixin, _AttachMixin, _WidgetBase, declare, template) { - return declare("app/widgets/MainWidget", [_WidgetBase, _AttachMixin, _TemplatedMixin], { + "dojo/_base/declare", + "dijit/form/TextBox", + "./ChildWidget2" +], function(require, _TemplatedMixin, _WidgetsInTemplateMixin, _AttachMixin, _WidgetBase, declare) { + return declare("app/widgets/MainWidget", [_WidgetBase, _AttachMixin, _TemplatedMixin, _WidgetsInTemplateMixin], { + contextRequire: require, templateString: "
" // + "Hello World!!! " // this works as it's dijit - + "
" + + "
" // this doesn't work as it's trying to fetch ./node_modules/dojo/ChildWidget which seems to be // relative to dojo/parser dojo/parser + "
" diff --git a/2021/12/dojo_demo2/index.html b/2021/12/dojo_demo2/index.html index c8c0619..97aa630 100644 --- a/2021/12/dojo_demo2/index.html +++ b/2021/12/dojo_demo2/index.html @@ -7,15 +7,21 @@ @@ -30,7 +36,19 @@ "app/widgets/MainWidget.js", "dojo/domReady!" ], function (dom, parser, MainWidget) { - parser.parse(); // parseOnLoad: true doesn't run this. Why??? + // parser.parse(); + // parseOnLoad: true doesn't run this. Why??? + // parser.parse({ + // scope: "app" + // }); + /** + parser.parse({ + "contextRequire": require, + "_dojoParserCtorMap": { + "./ContentPane": require('dijit/layout/ContentPane'), + } + }); + **/ var greeting = dom.byId('root'); var widget = new MainWidget(); widget.placeAt(greeting);