diff options
author | ctrlaltca@gmail.com <> | 2011-07-27 07:09:09 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-07-27 07:09:09 +0000 |
commit | 9ba60ba57ccfea1093ebb795d42f6b9cd63b31a2 (patch) | |
tree | 067ebc87b33472f8d0acbb1fe5abd103846ae990 /framework/Web | |
parent | 7eb2a754141e64d2cb1d47a21f9e4992205a289c (diff) |
fix for #265 + disable wheel event for TActiveDatePicker to avoid callback floods
Diffstat (limited to 'framework/Web')
-rwxr-xr-x | framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js | 6 | ||||
-rw-r--r-- | framework/Web/Javascripts/source/prado/datepicker/datepicker.js | 19 |
2 files changed, 18 insertions, 7 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js index 8857ee05..2ee97266 100755 --- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js @@ -87,5 +87,11 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker, // Make callback request
var request = new Prado.CallbackRequest(this.options.EventTarget,this.options);
request.dispatch();
+ },
+
+ // reimplement parent method to avoid handling mouse whell events,
+ // since they can cause floods of callback events
+ mouseWheelChange : function (event)
+ {
}
});
diff --git a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js index 8105823a..95ab43e7 100644 --- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js +++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js @@ -303,8 +303,10 @@ Prado.WebUI.TDatePicker.prototype = Event.observe(this._monthSelect, "change", this.monthSelect.bindEvent(this));
Event.observe(this._yearSelect, "change", this.yearSelect.bindEvent(this));
- // ie6 extension
+ // ie, opera
Event.observe(this._calDiv, "mousewheel", this.mouseWheelChange.bindEvent(this));
+ // ff
+ Event.observe(this._calDiv, "DOMMouseScroll", this.mouseWheelChange.bindEvent(this));
Event.observe(calendarBody, "click", this.selectDate.bindEvent(this));
@@ -448,15 +450,18 @@ Prado.WebUI.TDatePicker.prototype = this.setYear(Form.Element.getValue(Event.element(ev)));
},
- // ie6 extension
- mouseWheelChange : function (e)
+ mouseWheelChange : function (event)
{
- if (e == null) e = document.parentWindow.event;
- var n = - e.wheelDelta / 120;
+ var delta = 0;
+ if (!event) event = document.parentWindow.event;
+ if (event.wheelDelta) {
+ delta = event.wheelDelta/120;
+ if (window.opera) delta = -delta;
+ } else if (event.detail) { delta = -event.detail/3; }
+
var d = this.newDate(this.selectedDate);
- var m = d.getMonth() + n;
+ var m = d.getMonth() + Math.round(delta);
this.setMonth(m);
-
return false;
},
|