Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stéphane Martin on Mar 16, 2008 00:32
open dhtmlx forum
Positioning of dhtmlxCalendarObject

The dhtmlxCalendarObject has been linked to an input box. Unfortunately the calendar box is displayed right of the input box and is hidden by a flash file that is running right of the input box. Is there an option to position the dhtmlxCalendarObject with fixed x and fixed y values?

Best regards

Stéphane
Answer posted by Support on Mar 17, 2008 05:04
In case, when you creating calendar linked to input - it initial position will be always right to input ( can be changed only by source code modification - dhtmlxcalendar.js , line 493 )
The positions of calendar object can be changed by
    calendar.setPosition(x,y); // x and y are int values

Answer posted by Stephane Martin on Mar 17, 2008 10:23
Dear support,

thank you for your quick help. The file dhtmlxcalendar.js has only one declaration using setPosition in line 1190:

/**
*  @desc: set position for calendar object
*  @type: public
*  @topic: 0
*/
dhtmlxCalendarObject.prototype.setPosition = function(argA,argB,argC){
    if(typeof(argA)=='object'){
        var posAr = this.getPosition(argA)
        var left = posAr[0]+argA.offsetWidth+(argC||0);
        var top = posAr[1]+(argB||0);
    }
   
    this.entObj.style.position = "absolute";
    this.entObj.style.top = (top||argA)+"px";
    this.entObj.style.left = (left||argB)+"px";
}

Is that the part that has to be changed?

Best regards

Stephane Martin
Answer posted by Support on Mar 18, 2008 06:13
If you need just to set position of calendar you can use
    calendar.setPosition(x,y);
where calendar - object returned by dhtmlxCalendar constructor.

If you want to change default behavior please check dhtmlxgrid.js line 493
        with (div.style) {
            position = 'absolute';
            display = 'none';
            marginLeft = this.con.offsetWidth+'px';
            top = atop;
            left = aleft;
            zIndex = "99";

This is styles of calendars parent container, you can update them in any necessary way.
Answer posted on Mar 18, 2008 13:02
If you need just to set position of calendar you can use
    calendar.setPosition(x,y);
where calendar - object returned by dhtmlxCalendar constructor.

Thanks that was the trick :-)

Best regards

Stéphane