0
我有RadScheduler问题。在插入表单打开之前,我需要验证双击时间段的可用性。我使用高级插入表单。不幸的是,它没有OnAppointmentInserting或像这样的事件。我发现OnClientAppointmentInserting事件,我可以用它来验证,但我不能继续插入表格如果验证是正确的。下面的代码我使用的客户端验证,但它没有办法显示验证后插入表单:如何RadScheduler之前验证约定将
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);
}
});
}