Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by wang ran on Dec 22, 2009 19:12
open dhtmlx forum
Calendar component not disappear

hi, I am so use Calendar, and binding an input, but when the mouse clicks somewhere else, Calendar component will not disappear, you can look at to solve.
eg:
<html>
<head>
    <title>For demo purpose only :: &1</title>
    <link rel='STYLESHEET' type='text/css' href='codebase/dhtmlxcalendar.css'>
<script>
window.dhx_globalImgPath="codebase/imgs/";
</script>
<script src='codebase/dhtmlxcommon.js'></script>
<script src='codebase/dhtmlxcalendar.js'></script>
<script>
    var cal1
    window.onload = function () {
        cal1 = new dhtmlxCalendarObject('calInput1');
        cal1.setDateFormat("%e/%c/%y");
    }
    
</script>
<body>
    <h1>Attaching to input</h1>
    <p> You can attach calendar to input object.</p>
<table >
<tr>
<td valign="top"><strong>Click in a text fild</strong><br />
    <input type="text" id="calInput1" style="width: 200px; font-size:12px;" readonly="true"></td>
</tr>
</table>
</body>
</html>
Answer posted by Alex (support) on Dec 23, 2009 01:08

Hello,

to hide calendar where mouse is clicks somewhere you can try to use the following method:

document.body.onclick = function(){
  cal1.hide();
}

Answer posted by wang ran on Dec 23, 2009 20:39

First,thank you for the answer,but the Calendar component does not appear forever!

the code like this:

 <table id="rizhi" style="margin-left:5px">
  <tr>
    <td align="right">开始时间:</td>
    <td>
      <input type="text" id="startTime" name="startTime"  />
    </td>
  
  </tr>
 
</table>

<script type="text/javascript" >
var calendar = new dhtmlxCalendarObject("startTime");
calendar.setDateFormat("%Y-%m-%d");
calendar.draw();
document.body.onclick=function(){
calendar.hide();
}
</script>

the Calendar component does not appear!  would you like give me a better way! Thank you very much!

 

Answer posted by Alex (support) on Dec 24, 2009 01:03

By default calendar disappears without any additional event handlers. 

Please check the sample the calendar package dhtmlxCalendar/samples/01_initialization/01_calendar_attach_to_input.html

http://www.dhtmlx.com/docs/products/dhtmlxCalendar/samples/01_initialization/01_calendar_attach_to_input.html

Answer posted by wang ran on Dec 24, 2009 18:01

Our company is in July this year, bought all the products your company, when the product version is 2.1,

but you are now some products is 2.5, you will give our company to upgrade?

If we can upgrade, would there be compatibility problems?

This calendar  will not disappear in version 2.1

Answer posted by dhxSupport on Dec 28, 2009 02:44
This issue wasn't reproduced at the 2.5 version. If you have the same example as at the provided link, you issue will be fixed if you update you file.
Regarding version update please contact sales@dhtmlx.com