| 1 |
define(["dojo/_base/lang", "dojo/on", "dijit/registry", "dojo/date/stamp"], |
| 2 |
function(lang, on, registry, stamp){ |
| 3 |
var _onResults = []; |
| 4 |
|
| 5 |
var opener, datePicker2; |
| 6 |
|
| 7 |
return { |
| 8 |
init: function(){ |
| 9 |
opener = this.opener; |
| 10 |
var onResult = on(this.selDate1, "click", lang.hitch(this, function(){ |
| 11 |
this.datePicker2.set("value", date); |
| 12 |
this.opener.show(this.selDate1, ['below-centered','above-centered','after','before']); |
| 13 |
})); |
| 14 |
_onResults.push(onResult); |
| 15 |
|
| 16 |
onResult = on(this.save, "click", lang.hitch(this, function(){ |
| 17 |
this.opener.hide(true); |
| 18 |
date = this.selDate1.value = this.datePicker2.get("value"); |
| 19 |
})); |
| 20 |
_onResults.push(onResult); |
| 21 |
|
| 22 |
onResult = on(this.cancel, "click", lang.hitch(this, function(){ |
| 23 |
this.opener.hide(false); |
| 24 |
})); |
| 25 |
_onResults.push(onResult); |
| 26 |
|
| 27 |
datePicker2 = registry.byId("datePicker2"); |
| 28 |
|
| 29 |
date = stamp.toISOString(new Date(), {selector: "date"}); |
| 30 |
}, |
| 31 |
|
| 32 |
beforeActivate: function(){ |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
}, |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
destroy: function(){ |
| 51 |
var onResult = _onResults.pop(); |
| 52 |
while(onResult){ |
| 53 |
onResult.remove(); |
| 54 |
onResult = _onResults.pop(); |
| 55 |
} |
| 56 |
} |
| 57 |
}; |
| 58 |
}); |