summaryrefslogtreecommitdiff
path: root/lib/_CheckBoxTreeNode.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-08-23 09:56:34 +0300
committerAndrew Dolgov <[email protected]>2018-08-23 09:56:34 +0300
commita3e2f1a9c3b7fa5688f908bd0aa9ed4c6c539953 (patch)
treedee65ed57833371139cb62b97cae0de43aa5979a /lib/_CheckBoxTreeNode.js
parent54727f9534f8b17b57d87577ed1ec0e8be8be0f3 (diff)
define custom dojo modules with define() instead of require(), update startup module dependencies
Diffstat (limited to 'lib/_CheckBoxTreeNode.js')
-rw-r--r--lib/_CheckBoxTreeNode.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/_CheckBoxTreeNode.js b/lib/_CheckBoxTreeNode.js
new file mode 100644
index 000000000..4babffec2
--- /dev/null
+++ b/lib/_CheckBoxTreeNode.js
@@ -0,0 +1,42 @@
+define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree"], function (declare, domConstruct) {
+
+ return declare("lib._CheckBoxTreeNode", dijit._TreeNode,
+ {
+ // _checkbox: [protected] dojo.doc.element
+ // Local reference to the dojo.doc.element of type 'checkbox'
+ _checkbox: null,
+
+ _createCheckbox: function () {
+ // summary:
+ // Create a checkbox on the CheckBoxTreeNode
+ // description:
+ // Create a checkbox on the CheckBoxTreeNode. The checkbox is ONLY created if a
+ // valid reference was found in the dojo.data store or the attribute 'checkboxAll'
+ // is set to true. If the current state is 'undefined' no reference was found and
+ // 'checkboxAll' is set to false.
+ // Note: the attribute 'checkboxAll' is validated by the getCheckboxState function
+ // therefore no need to do that here. (see getCheckboxState for details).
+ //
+ var currState = this.tree.model.getCheckboxState(this.item);
+ if (currState !== undefined) {
+ this._checkbox = new dijit.form.CheckBox();
+ //this._checkbox = dojo.doc.createElement('input');
+ this._checkbox.type = 'checkbox';
+ this._checkbox.attr('checked', currState);
+ domConstruct.place(this._checkbox.domNode, this.expandoNode, 'after');
+ }
+ },
+
+ postCreate: function () {
+ // summary:
+ // Handle the creation of the checkbox after the CheckBoxTreeNode has been instanciated.
+ // description:
+ // Handle the creation of the checkbox after the CheckBoxTreeNode has been instanciated.
+ this._createCheckbox();
+ this.inherited(arguments);
+ }
+
+ });
+});
+
+