This is a migrated thread and some comments may be shown as answers.

Disable Edit and Delete and Insert after pass date and time

1 Answer 57 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 17 Feb 2016, 03:59 AM

hi

 How do I prevent any insert, edit and delete which is less than current date and time?

 

Thanks a lot

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 19 Feb 2016, 04:14 PM
Hello,

You can subscribe the Scheduler to the three events below, and in their handlers cancel the event if the user tries to create an event on a timeslot that precedes the current date or tries to edit/delete an existing appointment on such timeslot:
function OnClientAppointmentInserting(sender, args) {
    var startTime = args.get_targetSlot().get_startTime();
    var currentDate = new Date();
 
    if (startTime < currentDate) {
        args.set_cancel(true);
    }
}
 
function OnClientAppointmentDeleting(sender, args) {
    var startTime = args.get_appointment().get_start()
    var currentDate = new Date();
 
    if (startTime < currentDate) {
        args.set_cancel(true);
    }
}
 
function OnClientAppointmentEditing(sender, args) {
    var startTime = args.get_appointment().get_start()
    var currentDate = new Date();
 
    if (startTime < currentDate) {
        args.set_cancel(true);
    }
}

The Scheduler client-side events are listed in this article. And the SchedulerAppointment objects's methods can be found here.

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
L
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or