2014-02-13 53 views
0

如何防止编辑已在kendo计划程序中完成的事件。Kendo计划程序:防止编辑已完成的事件

这里有两种情况:

  1. 比方说,事件开始在2014年1月5日且持续(每日)IE 10天,直到1月15日2014年,因此,它不应该现在编辑(现=当前日期)

  2. 事件在2014年2月5日陈述,它将继续(每日)至2月25日。 8天之后,即2月13日编辑了整个活动系列。只应在2月13日至2月25日之间进行,不应完成一次。

任何帮助,不胜感激。

+0

@LarsHöppner:我做了链接http://demos.telerik.com/kendo-ui/web/scheduler/index.html上给出的示例。开始时可以,但我没有发现或可能未能注意到任何此类事件/代码,以防止编辑或修改已完成的事件。 – Praveen

回答

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

* ShowBookingPopup - 是自定义Java脚本函数,通过该函数您可以有条件允许或阻止如下所示的编辑。

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(); 
     } 

    } 

您还可以使用其他事件在Telerik的事件的例子进行了说明,并自定义您的调度程序的行为。 http://demos.telerik.com/kendo-ui/web/scheduler/move-resize.html