]>
Commit | Line | Data |
---|---|---|
a3e2f1a9 AD |
1 | define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree"], function (declare, domConstruct) { |
2 | ||
3 | return declare("lib._CheckBoxTreeNode", dijit._TreeNode, | |
4 | { | |
5 | // _checkbox: [protected] dojo.doc.element | |
6 | // Local reference to the dojo.doc.element of type 'checkbox' | |
7 | _checkbox: null, | |
8 | ||
9 | _createCheckbox: function () { | |
10 | // summary: | |
11 | // Create a checkbox on the CheckBoxTreeNode | |
12 | // description: | |
13 | // Create a checkbox on the CheckBoxTreeNode. The checkbox is ONLY created if a | |
14 | // valid reference was found in the dojo.data store or the attribute 'checkboxAll' | |
15 | // is set to true. If the current state is 'undefined' no reference was found and | |
16 | // 'checkboxAll' is set to false. | |
17 | // Note: the attribute 'checkboxAll' is validated by the getCheckboxState function | |
18 | // therefore no need to do that here. (see getCheckboxState for details). | |
19 | // | |
20 | var currState = this.tree.model.getCheckboxState(this.item); | |
21 | if (currState !== undefined) { | |
22 | this._checkbox = new dijit.form.CheckBox(); | |
23 | //this._checkbox = dojo.doc.createElement('input'); | |
24 | this._checkbox.type = 'checkbox'; | |
25 | this._checkbox.attr('checked', currState); | |
26 | domConstruct.place(this._checkbox.domNode, this.expandoNode, 'after'); | |
27 | } | |
28 | }, | |
29 | ||
30 | postCreate: function () { | |
31 | // summary: | |
32 | // Handle the creation of the checkbox after the CheckBoxTreeNode has been instanciated. | |
33 | // description: | |
34 | // Handle the creation of the checkbox after the CheckBoxTreeNode has been instanciated. | |
35 | this._createCheckbox(); | |
36 | this.inherited(arguments); | |
37 | } | |
38 | ||
39 | }); | |
40 | }); | |
41 | ||
42 |