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 | var onResult = on(this.cancel, "click", lang.hitch(this, function(){ |
---|
22 | this.opener.hide(false); |
---|
23 | })); |
---|
24 | _onResults.push(onResult); |
---|
25 | |
---|
26 | // initialize the global Date variable as today |
---|
27 | date = stamp.toISOString(new Date(), {selector: "date"}); |
---|
28 | }, |
---|
29 | |
---|
30 | beforeActivate: function(){ |
---|
31 | //console.log("date view beforeActivate()"); |
---|
32 | }, |
---|
33 | |
---|
34 | // view destroy |
---|
35 | destroy: function(){ |
---|
36 | var onResult = _onResults.pop(); |
---|
37 | while(onResult){ |
---|
38 | onResult.remove(); |
---|
39 | onResult = _onResults.pop(); |
---|
40 | } |
---|
41 | } |
---|
42 | }; |
---|
43 | }); |
---|