gpt4 book ai didi

c# - Kendo 日历中突出显示的日期仅在警报时有效

转载 作者:行者123 更新时间:2023-11-28 09:25:56 25 4
gpt4 key购买 nike

我见过很多关于“JavaScript 仅在警报时工作”的问题,但答案仅针对这些问题。我正在使用 Kendo Calender,并且想要突出显示数据库中的值中的特定日期。以下代码仅在写入警报时才能正常工作。请帮忙:

 var duedates = [];
function GetDueDates() {
$.ajax({
type: "POST",
url: "ChartBinder.asmx/GetDueDates",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
duedates = $.parseJSON(msg.d);
},
error: function (msg) {
alert("error");
}
});
}


$(document).ready(function () {
GetDueDates();

//当在此处插入警报时功能起作用..

               var today = new Date();
$("#calendar").kendoCalendar({
change: onChange,
navigate: onNavigate,
value: today,
dates: duedates,
month: {
// template for dates in month view
content: '# if ($.inArray(+data.date, data.dates) != -1) { #' +
'<div class="' +
"dataexist" +
'"></div>' +
'# } #' +
'#= data.value #'
},
footer: "Today - #=kendo.toString(data, 'd') #"

});

$(document).find("#panelbar").kendoPanelBar({
expandMode: "single"
});
});

最佳答案

得到解决方案:更改代码如下:

var duedates = [];       
function GetDueDates() {
$.ajax({
type: "POST",
url: "ChartBinder.asmx/GetDueDates",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
duedates = $.parseJSON(msg.d);
},
error: function (msg) {
alert("error");
} });
}

$(document).ready(function () {
GetDueDates();
setTimeout(function () { loadCalender(); }, 100);
$(document).find("#panelbar").kendoPanelBar({
expandMode: "single"
});
});


function loadCalender() {
var today = new Date();
$("#calendar").kendoCalendar({
change: onChange,
navigate: onNavigate,
value: today,
dates: duedates,
month: {
// template for dates in month view
content: '# if ($.inArray(+data.date, data.dates) != -1) { #' +
'<div class="' +
"dataexist" +
'"></div>' +
'# } #' +
'#= data.value #'
},
footer: "Today - #=kendo.toString(data, 'd') #"
});
}

关于c# - Kendo 日历中突出显示的日期仅在警报时有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14393855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com