0

如何防止编辑已在剑道调度程序中完成的事件。

以下是两种情况:

  1. 假设该活动于 2014 年 1 月 5 日开始,并且持续(每天)10 天,即到 2014 年 1 月 15 日。所以现在不应该编辑它(现在=当前日期)

  2. 活动于 2014 年 2 月 5 日宣布,并将持续(每天)至 2 月 25 日。8 天后,即 2 月 13 日,编辑了整个事件系列。它应仅在 2 月 13 日至 2 月 25 日期间生效,并且不应完成一次。

任何帮助都将不胜感激。

4

1 回答 1

1
@(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

于 2014-02-17T11:52:13.490 回答