cancel
Showing results for 
Search instead for 
Did you mean: 

YUI calendar problem

liuk88
Champ in-the-making
Champ in-the-making
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
1 REPLY 1

liuk88
Champ in-the-making
Champ in-the-making
Any answers?