我正在尝试禁用 jquery ui 的 datepicker 函数的某些日子,但是此代码返回错误:daySettings is undefined
在http://code.jquery.com/ui/1.9.2/jquery-ui.js中。这似乎是正确的,我不知道......请帮助!
var $j = jQuery.noConflict();
$j(document).ready(function() {
var group_id = <? echo $bp->groups->current_group->id; ?>;
var userid = <? echo $bp->loggedin_user->id; ?>;
var myBadDates = new Array ();
function checkAvailability(mydate){
jQuery.post(
ajaxurl,
{
action : 'check_date',
verificadata: "true", userid: userid, group_id: group_id
},
function( response ) {
obj = JSON.parse(response);
var key, quanti = 0;
for(key in obj.prenotati) {
if(obj.prenotati.hasOwnProperty(key)) {
var datafrom = obj.prenotati[quanti].datafrom;
var datato = obj.prenotati[quanti].datato;
myBadDates.push(datafrom);
myBadDates.push(datato);
quanti++;
}
}
var ritorno = true;
var returnclass ="available";
checkdate = $j.datepicker.formatDate('yy-mm-dd', mydate);
for(var i = 0; i < myBadDates.length; i++) {
$j(myBadDates[i])
if(myBadDates[i] == checkdate) {
ritorno = false; returnclass="unavailable";
}
}
return [ritorno,returnclass];
}
)
}
/* $myBadDates = new array("2013-03-03","2013-03-05");
function checkAvailability(mydate){
var $return=true;
var $returnclass ="available";
$checkdate = $j.datepicker.formatDate('yy-mm-dd', mydate);
for(var i = 0; i < $myBadDates.length; i++) {
if($myBadDates[i] == $checkdate) {
$return = false; $returnclass= "unavailable";
}
}
return [$return,$returnclass];
} */
$j('#datafrom').datepicker({
dateFormat : 'yy-mm-dd',
beforeShowDay: checkAvailability,
onSelect: function(dateText, inst) {
$j("#datafrom").val(dateText);
}
});
$j('#datato').datepicker({
dateFormat : 'yy-mm-dd',
beforeShowDay: checkAvailability,
onSelect: function(dateText, inst) {
$j("#datato").val(dateText);
}
});
});