Kendo Scheduler Prevents Editing / Destroying Certain Events

I created a Kendo Scheduler that binds to a remote data source. A remote data source is actually a combination of two separate data sources. This part is working fine.

The question is ... is there a way to prevent the destruction of certain events?

I stopped other forms of editing by checking a specific field in the properties of the event and calling e.preventDefault()in the events edit, moveStartand resizeStartif it should be read-only. This works fine, but I cannot prevent the deletion.

Any suggestions that were highly appreciated.

+4
source share
3

, , edit, moveStart reviseStart. . 2013.3.1119.340.

+5

, - remove . remove - , , , "" ).

, category, category "Holiday" .

remove: function(e)
{
  var event = e.event;
  if (event.category === "Holiday")
  {
    e.preventDefault();
    e.stopPropagation();
  }
},
dataBound: function(e)
{
  var scheduler = e.sender;
  $(".k-event").each(function() {
    var uid = $(this).data("uid");
    var event = scheduler.occurrenceByUid(uid);
    if (event.category === "Holiday")
    {
      // use .k-event-delete,.k-resize-handle if you want to prevent also resizing
      $(this).find(".k-event-delete").hide();
    }
  });
},
edit: function (e) {
   var event = e.event;
   if (event.category === "Holiday")
   {
     e.container.find(".k-scheduler-delete").hide();
   }
}
+3

FYI, ...

@(Html.Kendo().Scheduler<ScheduledEventViewModel>()
    .Name("scheduler")
    .Editable(e => e.Confirmation(false))
)

which deactivates the default prompt for the scheduler. Then you can make your invitation to the items you need.

There is also

.Editable(e => e.Destroy(false))

which you can do to remove X in the event window. This specific example will remove it for all events, but there may be a way to remove it for specific events.

+2
source

Source: https://habr.com/ru/post/1523937/


All Articles