diff --git a/demo/js/widget/multidatetime/multi.datetime.combo.js b/demo/js/widget/multidatetime/multi.datetime.combo.js index 63928c457d..30ba0feddc 100644 --- a/demo/js/widget/multidatetime/multi.datetime.combo.js +++ b/demo/js/widget/multidatetime/multi.datetime.combo.js @@ -41,20 +41,11 @@ BI.MultiDateTimeCombo = BI.inherit(BI.Single, { min: this.constants.DATE_MIN_VALUE, max: this.constants.DATE_MAX_VALUE }); + self.setValue(this.storeValue); this.popup.on(BI.MultiDateTimePopup.BUTTON_CANCEL_EVENT_CHANGE, function () { - self.setValue({ - value: { - year: date.getFullYear(), - month: date.getMonth(), - day: date.getDate(), - hour: date.getHours(), - minute: date.getMinutes(), - second: date.getSeconds() - } - }); self.combo.hideView(); - self.fireEvent(BI.MultiDateTimeCombo.EVENT_CONFIRM); + self.fireEvent(BI.MultiDateTimeCombo.EVENT_CANCEL); }); this.popup.on(BI.MultiDateTimePopup.BUTTON_OK_EVENT_CHANGE, function () { self.setValue(self.popup.getValue()); @@ -124,15 +115,11 @@ BI.MultiDateTimeCombo = BI.inherit(BI.Single, { }, getValue: function () { return this.storeValue; - }, - - hidePopupView: function () { - this.combo.hideView(); } }); +BI.MultiDateTimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; BI.MultiDateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.MultiDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiDateTimeCombo.EVENT_BEFORE_POPUPVIEW = "BI.MultiDateTimeCombo.EVENT_BEFORE_POPUPVIEW"; BI.shortcut('bi.multi_date_time_combo', BI.MultiDateTimeCombo); - diff --git a/demo/js/widget/multidatetime/multi.datetime.js b/demo/js/widget/multidatetime/multi.datetime.js index f86f54af10..8c903f0b19 100644 --- a/demo/js/widget/multidatetime/multi.datetime.js +++ b/demo/js/widget/multidatetime/multi.datetime.js @@ -15,8 +15,12 @@ BI.CustomMultiDateTimeCombo = BI.inherit(BI.Widget, { type: "bi.multi_date_time_combo", element: this }); + this.multiDateTime.on(BI.MultiDateTimeCombo.EVENT_CANCEL, function () { + self.fireEvent(BI.CustomMultiDateTimeCombo.EVENT_CANCEL); + }); + this.multiDateTime.on(BI.MultiDateTimeCombo.EVENT_CONFIRM, function () { - self.fireEvent(BI.CustomMultiDateTimeCombo.EVENT_CHANGE); + self.fireEvent(BI.CustomMultiDateTimeCombo.EVENT_CONFIRM); }); }, @@ -25,13 +29,10 @@ BI.CustomMultiDateTimeCombo = BI.inherit(BI.Widget, { }, setValue: function (v) { - if (BI.isEmpty(v)) { - this.multiDateTime.setValue(); - return; - } this.multiDateTime.setValue(v); } }); BI.CustomMultiDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.CustomMultiDateTimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; +BI.CustomMultiDateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.shortcut("bi.custom_multi_date_time_combo", BI.CustomMultiDateTimeCombo); - diff --git a/demo/js/widget/multidatetime/multi.datetime.popup.js b/demo/js/widget/multidatetime/multi.datetime.popup.js index ec1478427f..5a17460cec 100644 --- a/demo/js/widget/multidatetime/multi.datetime.popup.js +++ b/demo/js/widget/multidatetime/multi.datetime.popup.js @@ -111,16 +111,6 @@ BI.MultiDateTimePopup = BI.inherit(BI.Widget, { }] }); - var date = new Date(); - self.dateCombo.setValue({ - year: date.getFullYear(), - month: date.getMonth(), - day: date.getDate() - }); - self.hour.setValue(date.getHours()); - self.minute.setValue(date.getMinutes()); - self.second.setValue(date.getSeconds()); - this.dateButton = BI.createWidget({ type: "bi.grid", items: [[this.cancelButton, this.okButton]] diff --git a/demo/js/widget/multidatetime/multi.datetime.trigger.js b/demo/js/widget/multidatetime/multi.datetime.trigger.js index 249a6403de..fd0eacb046 100644 --- a/demo/js/widget/multidatetime/multi.datetime.trigger.js +++ b/demo/js/widget/multidatetime/multi.datetime.trigger.js @@ -19,7 +19,6 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, { _init: function () { BI.DateTimeTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options, c = this._const; - var date = new Date(); this.editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, @@ -27,8 +26,6 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, { vgap: c.vgap, disabled: true }); - this.editor.setValue(date.getFullYear() + "-" + self._printTime(date.getMonth() + 1) + "-" + self._printTime(date.getDate()) - + " " + self._printTime(date.getHours()) + ":" + self._printTime(date.getMinutes()) + ":" + self._printTime(date.getSeconds())); BI.createWidget({ type: "bi.htape",