1 | define(["dojo/_base/lang", "dojo/on", "dijit/registry", "dojo/date/stamp"], |
---|
2 | function(lang, on, registry, stamp){ |
---|
3 | var _onResults = []; // events on array |
---|
4 | var opener; |
---|
5 | |
---|
6 | return { |
---|
7 | init: function(){ |
---|
8 | opener = this.opener; |
---|
9 | var onResult = on(this.selDate1, "click", lang.hitch(this, function(){ |
---|
10 | this.datePicker2.set("value", date); |
---|
11 | this.opener.show(this.selDate1, ['below-centered','above-centered','after','before']); |
---|
12 | })); |
---|
13 | _onResults.push(onResult); |
---|
14 | |
---|
15 | var onResult = on(this.save, "click", lang.hitch(this, function(){ |
---|
16 | this.opener.hide(true); |
---|
17 | date = this.selDate1.value = this.datePicker2.get("value"); |
---|
18 | })); |
---|
19 | _onResults.push(onResult); |
---|
20 | |
---|
21 | onResult = on(this.cancel, "click", lang.hitch(this, function(){ |
---|
22 | this.opener.hide(false); |
---|
23 | })); |
---|
24 | _onResults.push(onResult); |
---|
25 | |
---|
26 | onResult = on(this.unloadSimple, "click", lang.hitch(this, function(e){ |
---|
27 | var params = {}; |
---|
28 | params.parent = this.parent; |
---|
29 | var view = this.parent.children.layoutApp2_simple; |
---|
30 | params.view = view; |
---|
31 | // params.viewId = view.id; |
---|
32 | this.app.emit("unload-view", params); |
---|
33 | })); |
---|
34 | _onResults.push(onResult); |
---|
35 | |
---|
36 | onResult = on(this.unloadList, "click", lang.hitch(this, function(e){ |
---|
37 | var params = {}; |
---|
38 | params.parent = this.parent; |
---|
39 | var view = this.parent.children.layoutApp2_listMain; |
---|
40 | params.view = view; |
---|
41 | //params.viewId = view.id; |
---|
42 | this.app.emit("unload-view", params); |
---|
43 | })); |
---|
44 | _onResults.push(onResult); |
---|
45 | |
---|
46 | // initialize the global Date variable as today |
---|
47 | date = stamp.toISOString(new Date(), {selector: "date"}); |
---|
48 | }, |
---|
49 | |
---|
50 | beforeActivate: function(){ |
---|
51 | //console.log("date view beforeActivate()"); |
---|
52 | }, |
---|
53 | |
---|
54 | |
---|
55 | // view destroy |
---|
56 | destroy: function(){ |
---|
57 | var onResult = _onResults.pop(); |
---|
58 | while(onResult){ |
---|
59 | onResult.remove(); |
---|
60 | onResult = _onResults.pop(); |
---|
61 | } |
---|
62 | } |
---|
63 | }; |
---|
64 | |
---|
65 | }); |
---|