Categories | Question details Back To List | ||
Close calendar if clicks on page Hello, How to hide calendar control if clicked outside calendar control only? I'm trying out this sample: ....... dhtmlxEvent(document.body,"click",function(){ <myCalendarObject>.hide(); }); ....... In this case the calendar control hides away always when clicked on the page but it hides even if `calendar picture` is clicked (!) How to hide a calendar control only when clicked outside calendar? Answer posted by Support on Aug 19, 2008 02:46 dhtmlxEvent(document.body,"click",function(){ <myCalendarObject>.hide(); });
//hide calendar onclick dhtmlxEvent(<myCalendarObject>.cont,"click",function(e){ (e||event).cancelBubble=true; }); //block click events inside calendar object Answer posted on Nov 04, 2008 03:13 Hello, I'm trying out this sample: dhtmlxEvent(document.body,"click",function(){ <myCalendarObject>.hide(); }); //hide calendar onclick In this case the code produces the following error: 'addEventListener' is null or not an object. Thanks.
Answer posted by Support on Nov 04, 2008 03:39 Such error can occur when a) first parameter of dhtmlxEvent is not a valid object ( in your case document.body not rendered yet, or calendar container not exist yet ) b) you are using not supported browser Answer posted on Nov 04, 2008 03:48 probably calendar container not exist yet(<myCalendarObject>.cont), how to create it? Thanks. Answer posted by Support on Nov 04, 2008 04:51 Actually the code of dhtmlxcalendar doens't use such property as calendar.cont at all, you probably need to use <myCalendarObject>.con Answer posted by Denis on Jun 05, 2009 05:58 I have done everything like you described in this post, thank you very much for the answer. Everything works except one thing. There is one more problem. I use dhtmlxGrid on my page. When I click on it, the calendar does not disappear. How can I fix it? Answer posted by Support on Jun 05, 2009 06:55 You need to add one more line of code dhtmlxEvent(mygrid.obj,"click",function(){ <myCalendarObject>.hide(); }); where mygrid - reference to the grid object Answer posted by Denis on Jun 05, 2009 07:23 Many thanks! |