mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Implement beforeShowDay callback during render
This is similar to the beforeShowDay callback found in the DatePicker widget from jquery UI (http://api.jqueryui.com/datepicker/#option-beforeShowDay). The only omission is a custom tooltip for the date. The beforeShowDay callback can be supplied when creating an instance of the DateTimePicker.
This commit is contained in:
parent
ff8a3d04af
commit
8e8f28cf05
@ -167,7 +167,8 @@
|
||||
roundTime:'round', // ceil, floor
|
||||
className:'',
|
||||
weekends : [],
|
||||
yearOffset:0
|
||||
yearOffset:0,
|
||||
beforeShowDay: function() { return [true,'']; }
|
||||
};
|
||||
// fix for ie8
|
||||
if ( !Array.prototype.indexOf ) {
|
||||
@ -383,7 +384,7 @@
|
||||
datepicker.addClass('active');
|
||||
else
|
||||
datepicker.removeClass('active');
|
||||
|
||||
|
||||
if( options.timepicker )
|
||||
timepicker.addClass('active');
|
||||
else
|
||||
@ -750,7 +751,7 @@
|
||||
minDate = _xdsoft_datetime.strtodate(options.minDate);
|
||||
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
|
||||
}
|
||||
var d,y,m,classes = [];
|
||||
var d,y,m,classes = [],customDateSettings;
|
||||
while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
|
||||
classes = [];
|
||||
i++;
|
||||
@ -763,6 +764,15 @@
|
||||
classes.push('xdsoft_disabled');
|
||||
}
|
||||
|
||||
customDateSettings = options.beforeShowDay.call(datetimepicker, start);
|
||||
if ( customDateSettings[0] === false ) {
|
||||
classes.push('xdsoft_disabled');
|
||||
}
|
||||
|
||||
if ( customDateSettings[1] != "" ) {
|
||||
classes.push(customDateSettings[1]);
|
||||
}
|
||||
|
||||
if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');
|
||||
|
||||
if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
|
||||
|
Loading…
Reference in New Issue
Block a user