Wijmo UI for the Web
beforeSelect Event
The jQuery.Event object.
The data with this event.
The beforeSelect event handler. A function called before user selects a day by mouse. Cancellable.
Syntax
Javascript (Usage) 
var instance; // Type: options
instance.beforeSelect = function(e, args) { };
Javascript (Specification) 
beforeSelect = function ( 
   e : Object,
   args : ISelectedDate
) { };

Parameters

e
The jQuery.Event object.
args
The data with this event.
Example
$("#calendar1").wijcalendar({
      beforeSelect: function (e, data) 
      {
             var selDates = $("#calendar1").wijcalendar('option', 'selectedDates'),
             selected = false,
             list;
             $.each(selDates, function (i, d)
                 {
                   if (data.date.getFullYear() === d.getFullYear() &&
                       data.date.getMonth() === d.getMonth() &&                        data.date.getDate() === d.getDate())
                                  {
                           selected = true;
                           return false;
                        }
             );
 
          if (selected) 
          {
                   $("#calendar1").wijcalendar('unSelectDate', data.date);
                      } else
                                 {
                           $("#calendar1").wijcalendar('selectDate', data.date);
                      }
           list = $("#msg").empty();
                       selDates = $("#calendar1").wijcalendar('option', 'selectedDates');
                      $.each(selDates, function (i, d) 
                      {
                var li = $("<li/>");
                li.text(d.getFullYear() + "/" + (d.getMonth() + 1) + "/" + d.getDate());
               list.append(li);
            });
               return false;
            }
                   });

See Also

Reference

options type

 

 


© 2013 All Rights Reserved.

Send comments on this topic.