我对 RadScheduler 有疑问。在插入表单打开之前,我需要验证双击时隙的可用性。我使用高级插入表单。不幸的是,它没有 OnAppointmentInserting 或类似的事件。我找到了 OnClientAppointmentInserting 事件,我可以将其用于验证,但如果验证正确,我将无法继续插入表单。按照我用于客户端验证的代码,但它无法在验证后显示插入表单:
function beforeInserting(s, e) {
var url = '';
var requestUrl = window.location.href.toLowerCase();
if (requestUrl.indexOf('/views/') != -1)
url = requestUrl.substring(0, requestUrl.indexOf('/views/')) + '/jobservice.svc/IsTimeAvailable?userId=0';
e.set_cancel(true);
var app = e.get_targetSlot();
$.ajax({
url: url,
accepts: 'application/json, text/javascript, */*',
cache: false,
success: function (r) {
if (r != '') {
alert(r);
return;
}
else {
var scheduler = $find("<%= rdJobScheduler.ClientID %>");
var newApp = new Telerik.Web.UI.SchedulerAppointment();
newApp.set_start(app.get_startTime());
newApp.set_end(app.get_endTime());
// This is not working properly it just send OnInserted event to server
// scheduler.insertAppointment(newApp);
}
},
error: function (err, text, xhr) {
alert(text);
}
});
}