Domanda

How to prevent editing an event that was already completed in kendo scheduler.

Here are the two scenarios:

  1. Lets say the event started on Jan 5th 2014 and it was continued(daily) 10 days i.e. till Jan 15th 2014. So it should not be edited now(now=current date)

  2. Event stated on Feb 5th 2014 and it is going to continue(daily) till Feb 25th. After 8 days i.e. on Feb 13th edited the entire event series. It should only effect from Feb 13 to Feb 25th and should not effect completed once.

Any help could be appreciated.

È stato utile?

Soluzione

@(Html.Kendo().Scheduler<ViewModel>()
  .Name("scheduler")
    .Date(DateTime.Today)
    .Events(events => events
         .Edit("ShowBookingPopup")
         .Save("ShowBookingPopup")
   ......
)

*ShowBookingPopup - is the custom java script function through which you can have a condition to allow or block the editing like below.

   function ShowBookingPopup(e) {
         var today = new Date();
        // Your custom condition to allow/block editing of the event
        if (e.event.Start < today) { 
            // If the event date is in the past then disallow update by blocking the default behavior and showing an alert for the same
           setTimeout(function () {
                           alert("Cannot edit the event.");
                       }, 0);
           e.preventDefault();
        }

     }

You can also use other events explained in the example of telerik events and customize to your behavior of the scheduler. http://demos.telerik.com/kendo-ui/web/scheduler/move-resize.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top