summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorcarlgmathisen <>2008-12-01 13:18:33 +0000
committercarlgmathisen <>2008-12-01 13:18:33 +0000
commit8ae604cbb402a2e8a42412dbc4367fdf12672727 (patch)
treecd02784f1954dbafdb0397517a8a15c47ff3879a /framework/Web
parent5056ad574b2c6bf91bfa5ffe9af8f7168f16069d (diff)
Issue 29 - position for popup in TDatePicker/TActiveDatePicker
Diffstat (limited to 'framework/Web')
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js7
-rw-r--r--framework/Web/Javascripts/source/prado/datepicker/datepicker.js21
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php1
3 files changed, 18 insertions, 11 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
index 27c2aeba..87b48bf3 100755
--- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
@@ -11,6 +11,7 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
this.weekSlot = new Array(6);
this.minimalDaysInFirstWeek = 4;
this.selectedDate = this.newDate();
+ this.positionMode = 'Bottom';
//which element to trigger to show the calendar
if(this.options.Trigger)
@@ -23,6 +24,12 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
this.trigger = this.control;
var triggerEvent = this.options.TriggerEvent || "focus";
}
+
+ // Popup position
+ if(this.options.PositionMode == 'Top')
+ {
+ this.positionMode = this.options.PositionMode;
+ }
Object.extend(this,options);
diff --git a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
index 13637f6d..a16cc3d6 100644
--- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
+++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
@@ -609,20 +609,11 @@ Prado.WebUI.TDatePicker.prototype =
{
var pos = this.control.positionedOffset();
- if(this.positionMode=='Top')
- {
- pos[1] = (document.body.clientHeight - pos[1]);
- this._calDiv.style.bottom = (pos[1]-1) + "px";
- }
- else
- {
- pos[1] += this.getDatePickerOffsetHeight();
- this._calDiv.style.top = (pos[1]-1) + "px";
- }
+ pos[1] += this.getDatePickerOffsetHeight();
+ this._calDiv.style.top = (pos[1]-1) + "px";
this._calDiv.style.display = "block";
this._calDiv.style.left = pos[0] + "px";
- this.ieHack(false);
this.documentClickEvent = this.hideOnClick.bindEvent(this);
this.documentKeyDownEvent = this.keyPressed.bindEvent(this);
Event.observe(document.body, "click", this.documentClickEvent);
@@ -634,6 +625,14 @@ Prado.WebUI.TDatePicker.prototype =
}
Event.observe(document,"keydown", this.documentKeyDownEvent);
this.showing = true;
+
+ if(this.positionMode=='Top')
+ {
+ this._calDiv.style.top = ((pos[1]-1) - this.getDatePickerOffsetHeight() - this._calDiv.offsetHeight) + 'px';
+ if(Prado.Browser().ie)
+ this.iePopup = this._calDiv.style.top;
+ }
+ this.ieHack(false);
}
},
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 916902cd..770099eb 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -64,6 +64,7 @@ Prado::using('System.Web.UI.WebControls.TTextBox');
* input field.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @author Carl G. Mathisen <carlgmathisen@gmail.com>
* @version $Id$
* @package System.Web.UI.WebControls
* @since 3.0