Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Oct 14, 2009 00:49
open dhtmlx forum
Calendar position bug or problem

Hi!

I my goal is to build text input for dates and I want to have pop-up calendar, which opens and closes by clicking on calendar icon next to the text input. Everything works fine except the pop-up calendar's position. Calendar's background and header seems to be in ride place but the content of the calendar (days, weekdays, months, years and month navigation images) are out of the calendar's background. What I do wrong?

Here is my code:
<input type="text" name="input" id="input" value="" />
<img id="calendaricon" src="/dhtmlx/imgs/icon_minicalendar.gif" onclick="toggle();" />
<div id="container"></div>

<script type="text/javascript">
    
    var calendar;
    
    window.onload = initCalendar();
    
    //initialize the popup calendar
    function initCalendar(){
        calendar = new dhtmlxCalendarObject("container",false,{isMonthEditable: true, isYearEditable: true,isWinHeader: true});
        calendar.draw();
        calendar.setPosition(document.getElementById("calendaricon"));
        calendar.setSkin("yahoolike");
        calendar.hide();
    
        calendar.attachEvent("onClick",function(date){
        var input = document.getElementById("input");
            input.value = calendar.getFormatedDate("%d.%m.%Y", date);
            calendar.hide();
    });
    }
    
    //
    function toggle(){
        if(calendar.isVisible()){
            calendar.hide();
        }
        else{
            calendar.show();
        }
    }
</script>
Answer posted by Alex (support) on Oct 14, 2009 05:07

Hello,

please check that there are no css classes that can redefine other classes.

The working sample is attached

Attachments (1)
sample.zip38.74 Kb
Answer posted on Oct 18, 2009 23:58
Hi,

Have you any experience what kind of style definitions can mess up display of the pop-up calendar?


Answer posted by Alex (support) on Oct 19, 2009 02:16

Hello, 

some global classes can cause this issue. For example css class for body or div. Please, provide the complete demo where we can recreate the issue

Answer posted on Oct 19, 2009 03:33
Hi,

I found the css code, which messed up calendar's display. The calendar was inside a table, which had following style class:

.classname td
{
    border: 1px solid gray;
    padding: 5px;
    vertical-align: top;
}

So that probably affected also calendar's td tags.
Answer posted by Alex (support) on Oct 19, 2009 04:59

Hello,

calendar has several tables in it. So, this class can break calendar styles.