diff --git a/2021/12/dojo_demo2/app/widgets/MainWidget.html b/2021/12/dojo_demo2/app/widgets/MainWidget.html new file mode 100644 index 0000000..9896f18 --- /dev/null +++ b/2021/12/dojo_demo2/app/widgets/MainWidget.html @@ -0,0 +1,18 @@ +
+
+ +
+
+
    +
  1. I'm opened
  2. +
  3. I'm opened
  4. +
  5. I'm opened
  6. +
  7. I'm opened
  8. +
+
+
+ I'm closed +
+
+ +
\ 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 8c61d7e..591f3f5 100644 --- a/2021/12/dojo_demo2/app/widgets/MainWidget.js +++ b/2021/12/dojo_demo2/app/widgets/MainWidget.js @@ -5,17 +5,28 @@ define([ "dijit/_AttachMixin", "dijit/_WidgetBase", "dojo/_base/declare", + "dojo/text!./MainWidget.html", + "dijit/TitlePane", "dijit/form/TextBox", "./ChildWidget2" -], function(require, _TemplatedMixin, _WidgetsInTemplateMixin, _AttachMixin, _WidgetBase, declare) { +], function(require, _TemplatedMixin, _WidgetsInTemplateMixin, _AttachMixin, _WidgetBase, declare, template) { 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 - + "
" + templateString: template, + postCreate: function() { + this.inherited(arguments); + + let pane1Toggle = this.pane1.toggle.bind(this.pane1); + let pane2Toggle = this.pane2.toggle.bind(this.pane2); + this.pane1.arrowNode.innerHTML = '
'; + this.pane1.toggle = this.pane2.toggle = (function() { + this.pane1.arrowNode.innerHTML = this.pane1.open + ? '
' + : '
'; + + pane1Toggle(); + pane2Toggle(); + }).bind(this); + } }); }); \ No newline at end of file diff --git a/2021/12/dojo_demo2/index.html b/2021/12/dojo_demo2/index.html index 97aa630..9d085d6 100644 --- a/2021/12/dojo_demo2/index.html +++ b/2021/12/dojo_demo2/index.html @@ -5,6 +5,21 @@ Dojo App + + + + +