summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-07-28 08:01:06 +0000
committerctrlaltca@gmail.com <>2011-07-28 08:01:06 +0000
commit7d354acd7a582f6da33177be3567effec003f3a8 (patch)
treefbb20b7d12e0bd9bcd185133e59398e078eec612 /framework/Web/Javascripts
parent9ba60ba57ccfea1093ebb795d42f6b9cd63b31a2 (diff)
applied the "delayed callback" patch for TActiveDatePicker (ticker #265)
Diffstat (limited to 'framework/Web/Javascripts')
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js6
-rw-r--r--framework/Web/Javascripts/source/prado/datepicker/datepicker.js36
2 files changed, 28 insertions, 14 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
index 2ee97266..8857ee05 100755
--- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
@@ -87,11 +87,5 @@ 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 95ab43e7..3ee9e28f 100644
--- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
+++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
@@ -461,7 +461,7 @@ Prado.WebUI.TDatePicker.prototype =
var d = this.newDate(this.selectedDate);
var m = d.getMonth() + Math.round(delta);
- this.setMonth(m);
+ this.setMonth(m,true);
return false;
},
@@ -486,13 +486,33 @@ Prado.WebUI.TDatePicker.prototype =
this.options.OnDateChanged(this, date);
}
},
+
+ fireChangeEvent: function(element, capped)
+ {
+ if (capped)
+ {
+ var obj = this;
+
+ if (typeof(obj.changeeventtimer)!="undefined")
+ {
+ clearTimeout(obj.changeeventtimer);
+ obj.changeeventtimer = null;
+ }
+ obj.changeeventtimer = setTimeout(
+ function() { obj.changeeventtimer = null; Event.fireEvent(element, "change"); },
+ 1500
+ );
+ }
+ else
+ Event.fireEvent(element, "change");
+ },
- onChange : function()
+ onChange : function(ref, date, capevents)
{
if(this.options.InputMode == "TextBox")
{
this.control.value = this.formatDate();
- Event.fireEvent(this.control, "change");
+ this.fireChangeEvent(this.control, capevents);
}
else
{
@@ -515,7 +535,7 @@ Prado.WebUI.TDatePicker.prototype =
for(var i = 0; i < years.length; i++)
years[i].selected = years[i].value.toInteger() == currentYear;
}
- Event.fireEvent(day || month || year, "change");
+ this.fireChangeEvent(day || month || year, capped);
}
},
@@ -533,7 +553,7 @@ Prado.WebUI.TDatePicker.prototype =
return new Date(Math.min(Math.max(date.getFullYear(),this.FromYear),this.UpToYear), date.getMonth(), date.getDate(), 0,0,0);
},
- setSelectedDate : function(date)
+ setSelectedDate : function(date, capevents)
{
if (date == null)
return;
@@ -544,7 +564,7 @@ Prado.WebUI.TDatePicker.prototype =
this.updateHeader();
this.update();
if (dateChanged && typeof(this.onChange) == "function")
- this.onChange(this, date);
+ this.onChange(this, date, capevents);
},
getElement : function()
@@ -564,12 +584,12 @@ Prado.WebUI.TDatePicker.prototype =
this.setSelectedDate(d);
},
- setMonth : function (month)
+ setMonth : function (month, capevents)
{
var d = this.newDate(this.selectedDate);
d.setDate(Math.min(d.getDate(), this.getDaysPerMonth(month,d.getFullYear())));
d.setMonth(month);
- this.setSelectedDate(d);
+ this.setSelectedDate(d,capevents);
},
nextMonth : function ()