[
https://issues.apache.org/jira/browse/TOMAHAWK-205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482783
]
Dominique Jean-Prost commented on TOMAHAWK-205:
-----------------------------------------------
Hello,
I give you the correction, even though it's not in a patch format (I don't know
how to produce it).
Thanks to Fabien Grandgérard.
In the file org\apache\myfaces\custom\calendar\resource\popcalendar.js :
Add the following line : aTag = aTag.parentNode; line#1330 :
Fixed script function :
org_apache_myfaces_PopupCalendar.prototype._popUpCalendar_Show = function(ctl)
{
this.saveSelectedDate.date = this.selectedDate.date;
this.saveSelectedDate.month = this.selectedDate.month;
this.saveSelectedDate.year = this.selectedDate.year;
var leftpos = 0;
var toppos = 0;
var aTag = ctl;
var aTagPositioningisAbsolute = false;
// Added try-catch to the next loop (MYFACES-870)
try
{
do {
aTag = aTag.offsetParent;
leftpos += aTag.offsetLeft;
toppos += aTag.offsetTop;
aTagPositioningisAbsolute = (aTag.style.position == "absolute")
aTag = aTag.parentNode;// <----
*****************************************************************************LINE
TO ADD HERE*********************************************
}
while ((aTag.tagName != "BODY") && (aTag.tagName != "DIV") &&
(!aTagPositioningisAbsolute));
}
catch (ex)
{
// ignore
}
var leftScrollOffset = 0;
var topScrollOffset = 0;
aTag = ctl;
// Added try-catch (MYFACES-870)
try
{
do {
leftScrollOffset += aTag.scrollLeft;
topScrollOffset += aTag.scrollTop;
aTag = aTag.parentNode;
}
while ((aTag.tagName != "BODY") && (aTag.tagName != "DIV") &&
(aTag.style.position != "absolute"));
}
catch (ex)
{
// ignore
}
var bodyRect = this._getVisibleBodyRectangle();
var cal = this.calendarDiv;
var top = 0;
var left = 0
if (aTagPositioningisAbsolute) {
top = ctl.offsetTop - topScrollOffset + ctl.offsetHeight + 2;
left = ctl.offsetLeft - leftScrollOffset;
}
else {
top = ctl.offsetTop + toppos - topScrollOffset + ctl.offsetHeight + 2;
left = ctl.offsetLeft + leftpos - leftScrollOffset;
}
if(this.initData.popupLeft)
{
left-=cal.offsetWidth;
}
if (left + cal.offsetWidth > bodyRect.right)
{
left = bodyRect.right - cal.offsetWidth;
}
if (top + cal.offsetHeight > bodyRect.bottom)
{
top = bodyRect.bottom - cal.offsetHeight;
}
if (left < bodyRect.left)
{
left = bodyRect.left;
}
if (top < bodyRect.top)
{
top = bodyRect.top;
}
this.calendarDiv.style.left = this.initData.fixedX == -1 ? left + "px":
this.initData.fixedX;
this.calendarDiv.style.top = this.initData.fixedY == -1 ? top + "px":
this.initData.fixedY;
this._constructCalendar(1, this.selectedDate.month, this.selectedDate.year);
this.calendarDiv.style.visibility = (this.dom || this.ie)? "visible" :
"show";
this.bCalendarHidden = false;
setTimeout((function()
{
this._hideElement(this.calendarDiv);
}).bind(this), 200);
this._hideElement(this.calendarDiv);
this.bClickOnCalendar = true;
}
> inputCalendar Popup positioned incorrectly in scrollable div
> ------------------------------------------------------------
>
> Key: TOMAHAWK-205
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-205
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Components: Calendar
> Affects Versions: 1.1.2-SNAPSHOT
> Reporter: Geoffrey Longo
>
> The popup for the inputCalendar is positioned relative to the body of the
> page, not the containing div. Therefore, a calendar that is inside a
> scrollable div (overflow: auto) may not be positioned correctly if the
> containing div's left and top positons are not the same as the body.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.