AnsweredAssumed Answered

YUI calendar problem

Question asked by liuk88 on Mar 3, 2014
Latest reply on Mar 6, 2014 by liuk88
Hello, i have a "hide problem" in a yui calendar i put in a dashlet.
I have two text fields, with the calendar attached to them.
The calendar write the date in the text field when a date is selected.
The behaviour is the following: when i select a date in the current month (that is the month shown at the beginning), all works fine, the date is written in the field and the calendar closed. The problem is when i change month; in this case the date is again written well in the text field, but the calendar not closing (even if i click outside it) and remains hanged forever.
I put the code here, help pls!




//this is the .use() function

YUI().use('datatype-date-format', 'overlay', "node", "calendar", 'event-hover', function(Y) {
   var
   mouseover_calendar = false,
   current_input = null,
   mycalendar = new Y.Calendar({
      contentBox: "#mycalendar",
      visible: true,
      render : true,
      showPrevMonth: true,
      showNextMonth: true
   }).on({
      'selectionChange': function(e) {
         current_input.set('value', Y.DataType.Date.format(e.newSelection[0], {
            format: '%d/%m/%Y'
         }));

         mouseover_calendar = false;
         myoverlay.hide();
      },
      'mouseenter': function(e) {
         mouseover_calendar = true;
      },
      'mouseleave': function(e) {
         mouseover_calendar = false;
      }
   }),

   myoverlay = new Y.Overlay({
      boundingBox: "#myoverlay",
      zIndex: 10,
      render : true,
      visible: false
   }),
   
   input_calendar = {
      'blur': function(e) {
         if (mouseover_calendar == false) {
            '<div class="yui3-skin-sam">'
            myoverlay.hide();
         }
      },

      'focus': function(e) {
         current_input = Y.one(e.target);
         myoverlay.align(current_input, ['tl', 'bl']).show();
      }
   };

   Y.all('input.af_calendar').on(input_calendar);
   
});


//I attached the html code then (a part of a my table)




Thanks to all

Attachments

Outcomes