Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mort Reddov on Jan 14, 2009 10:09
open dhtmlx forum
dhtmlxDblCalendarObject -- setPosition() not working in IE 6

I am trying to set the doublecalendar's position using the following code:

[code]
doubleCal.leftCalendar.setPosition(topPos,leftPos);
doubleCal.rightCalendar.setPosition(topPos,leftPos+164);
[/code]

With FireFox 3.0.5, this works fine.
IE 6 (SP2) however reports the following error:

Line: 92
Char: 213
Error: 'this.ifr.style' is null or not an object
Code: 0

Using a single calendar, IE works well:
[code]
singleCal.setPosition(topPos+20,leftPos+2);
[/code]

I am using dhtmlxCalendar v.1.1 build 81107

Many thanks for your help.
Answer posted by Support on Jan 15, 2009 02:02
The setPosition method is not purposed for such use-case ( positioning of separate calendars inside dblCalendar ) 
If this is really necessary in your case, you can set related css settings directly as 

   doubleCal.leftCalendar.parent.style.top = topPos+"px";
   doubleCal.leftCalendar.parent.style.left = leftPos+"px";
Answer posted by Mort Reddov on Jan 15, 2009 02:48
Sorry, but it's not working.

The doubleCalendar is displayed in the browser's top left corner (as if I would not have specified any positioning data).

In your reply, you mentioned that setPosition() is not meant to position separate calendars inside the doubleCalendar object.

Is there a way to set the position for the whole doubleCalendar (instead of doing it separately for the left and right calendar)?

Many thanks for your help!
Answer posted by Support on Jan 15, 2009 07:46
There is no separate method for dblCalendar, but if you initializing dblCalendar in some HTML container you can just change position of such object. ( first parameter of constructor ) 
Answer posted by Mort Reddov on Jan 15, 2009 08:46
This does the trick - thank you very much!

For documentation purposes:

      function doCreateDoubleCalendar(clickedDateFilter) {
        var doubleCalImgId = clickedDateFilter + "_double_date_picker";
        var leftPos = findPosX(document.getElementById(doubleCalImgId));
        var topPos = findPosY(document.getElementById(doubleCalImgId));
        if (is_IE) {
          document.getElementById("doubleCal_container").style.top = topPos + 20;
          document.getElementById("doubleCal_container").style.left = leftPos + 2;
        } else { // FF 3.0
          doubleCal.leftCalendar.setPosition(topPos-65,leftPos-6);
          doubleCal.rightCalendar.setPosition(topPos-65,leftPos+158);
        }
        doubleCal.show();
      // blahblah...