簡體   English   中英

Kendo Scheduler:防止編輯已完成的事件

[英]Kendo Scheduler: Prevent editing for completed event

如何防止編輯在Kendo Scheduler中已經完成的事件。

這是兩種情況:

  1. 假設該活動於2014年1月5日開始,並且一直持續(每天)10天,即直到2014年1月15日。因此,不應立即對其進行編輯(現在=當前日期)

  2. 該活動已於2014年2月5日聲明,並將持續(每天)至2月25日。 8天后,即2月13日,編輯了整個活動系列。 它僅應在2月13日至2月25日生效,並且不應生效一次。

任何幫助,不勝感激。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM