diff options
| author | wei <> | 2006-05-31 08:33:30 +0000 | 
|---|---|---|
| committer | wei <> | 2006-05-31 08:33:30 +0000 | 
| commit | 5081873dda167cd224be2c4b42e57128f51c89da (patch) | |
| tree | 3fc8b66225a63b3e989c70cb268bb6dfc5311975 /framework/Web/Javascripts/datepicker | |
| parent | b21b6f82ede30d20a7d0f8e2a2ba8b682ff62113 (diff) | |
Fixed #199
Diffstat (limited to 'framework/Web/Javascripts/datepicker')
| -rw-r--r-- | framework/Web/Javascripts/datepicker/datepicker.js | 34 | 
1 files changed, 23 insertions, 11 deletions
diff --git a/framework/Web/Javascripts/datepicker/datepicker.js b/framework/Web/Javascripts/datepicker/datepicker.js index d5d9496c..e704e950 100644 --- a/framework/Web/Javascripts/datepicker/datepicker.js +++ b/framework/Web/Javascripts/datepicker/datepicker.js @@ -282,8 +282,11 @@ Prado.WebUI.TDatePicker.prototype =  		Event.observe(this._calDiv, "mousewheel", this.mouseWheelChange.bindEvent(this));		
  		Event.observe(calendarBody, "click", this.selectDate.bindEvent(this));
 +		
 +		Event.observe(this.control, "blur", this.hide.bind(this));
 +		Prado.Element.focus(this.control);
 -	},
 +	},A
  	ieHack : function(cleanup) 
  	{
 @@ -305,7 +308,7 @@ Prado.WebUI.TDatePicker.prototype =  		if (!ev) ev = document.parentWindow.event;
  		var kc = ev.keyCode != null ? ev.keyCode : ev.charCode;
 -		if(kc == Event.KEY_RETURN)
 +		if(kc == Event.KEY_RETURN || kc == Event.KEY_SPACEBAR)
  		{
  			this.setSelectedDate(this.selectedDate);
  			Event.stop(ev);
 @@ -526,6 +529,22 @@ Prado.WebUI.TDatePicker.prototype =  		this.setMonth(this.selectedDate.getMonth()-1);
  	},
 +	getDatePickerOffsetHeight : function()
 +	{
 +		if(this.options.InputMode == "TextBox")
 +			return this.control.offsetHeight;
 +
 +		var control = Prado.WebUI.TDatePicker.getDayListControl(this.control);
 +		if(control) return control.offsetHeight;
 +
 +		var control = Prado.WebUI.TDatePicker.getMonthListControl(this.control);
 +		if(control) return control.offsetHeight;		
 +
 +		var control = Prado.WebUI.TDatePicker.getYearListControl(this.control);
 +		if(control) return control.offsetHeight;	
 +		return 0;
 +	},
 +	
  	show : function() 
  	{
  		this.create();
 @@ -534,15 +553,8 @@ Prado.WebUI.TDatePicker.prototype =  		{
  			var pos = Position.cumulativeOffset(this.control);
 -			if(this.options.InputMode == "TextBox")
 -				pos[1] += this.control.offsetHeight;
 -			else
 -			{
 -				var dayList = Prado.WebUI.TDatePicker.getDayListControl(this.control);
 -				if(dayList)
 -					pos[1] += dayList.offsetHeight-1;
 -			}
 -
 +			pos[1] += this.getDatePickerOffsetHeight();
 +			
  			this._calDiv.style.display = "block";
  			this._calDiv.style.top = (pos[1]-1) + "px";
  			this._calDiv.style.left = pos[0] + "px";
  | 
