I am trying to disable multiple dates after I initialized Date Picker .
I initialize the collector as follows:
$( document ).ready(function() {
$('#inputDatetime').pickadate({
format: 'dd. mmmm yyyy',
formatSubmit: 'yyyy-mm-dd',
min: dt,
selectYears: 2,
selectMonths: true
});
});
Now the user performs some action that fires the event onChange(). The function disableDates()prepares a few more dates for disconnection and sets it to the collector using the method set:
function disableDates() {
var disabledDays = [];
$.ajax({
url: 'partners/getInactiveDays',
dataType: 'json',
async: false,
success: function(data) {
$.each(data.days, function(i, d) {
disabledDays.push(parseInt(d.Day.id));
});
}
});
var $input = $('#inputDatetime').pickadate();
var picker = $input.pickadate('picker');
picker.set({
disable: disabledDays
});
}
Please note that in my case disableDays contains integers (indicating weekdays) and dates according to the documentation ( http://amsul.ca/pickadate.js/date/#disable-dates ).
disableDates() , , AJAX. , . , , . . stop() .start() .render(), - .
?