Hi,

I just found one more bug in myFaces calendar component. If we use calendar in scrollable div, then calendar opens in the below frame and not beside the button.
So I made few changes in  popcalendar.js to fix this bug, now calendar works fine in scrollable div.

Add following code :

//============ CODE ADDED BY ARSHAD ALI =================
//browser detection
var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.>
var tempX = 0
var tempY = 0

function getMouseXY(e)
{
  if( IE ) //if IE
  {
   
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
   
  }
  else
  { 
    tempX = e.pageX
    tempY = e.pageY
  } 

  if( tempX < 0 ) { tempX = 0 }
  if( tempY < 0 ){ tempY = 0 } 

  return true
}
//========================================================

and then in function jscalendarPopUpCalendar_Show(ctl) comment following code:

/*
    var    leftpos = 0;
    var    toppos = 0;

    var aTag = ctl;
    do {
        aTag = aTag.offsetParent;
        leftpos    += aTag.offsetLeft;
        toppos += aTag.offsetTop;
    } while(aTag.tagName!="BODY");
    */

I really couldnot understand why myFaces people calculate X,Y like this(may be any specific reason, but doesnot work in scrollable div)
Now use variables tempX and tempY for xy positions to show the calendar:

jscalendarCrossobj.left = tempX;
jscalendarCrossobj.top = tempY;

ragards
 
Arshad Ali.

Reply via email to