summaryrefslogtreecommitdiff
path: root/lib/_CheckBoxTreeNode.js
diff options
context:
space:
mode:
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);
+ }
+
+ });
+});
+
+