有没有办法禁用kendo ui调度程序中的特定事件? [英] Is there a way to disable a specific event in kendo ui scheduler?

查看:229
本文介绍了有没有办法禁用kendo ui调度程序中的特定事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Kendo UI,js和调度程序组件。



我的问题是,如果有办法从调度程序禁用特定的事件。 p>

我发现这个,但是这会禁用调度程序中的所有事件。我想禁用一个特定的事件。代码应该是这样的>

  function disableEvents()
{
var data = $ #scheduler)的数据( kendoScheduler)dataSource.data()。;
data.forEach(function(event){
if(event.ID ='2')
{
event.disable = true; //我已经尝试过事件。 editable = true;
}
});
}

我找不到属性可编辑或禁用,或类似的东西。也许有一种方法可以使用jquery禁用它。有人可以帮助我吗?



谢谢!

解决方案

需要实现Kendo的限制示例中指定的所有事件,并且在您的条件不成功的情况下执行preventDefault行为。



参考: Kendo限制事件说明



如果要禁止任何更改的事件,您将需要处理所有事件(即编辑,保存,调整大小,移动)。事件如下:

  resize:function(e){
if(e.event.meetingID = 1 ){
this.wrapper.find(。k-marquee-color)。addClass(invalid-slot);
e.preventDefault();
}
},
move:function(e){
if(e.event.meetingId = 1){
this.wrapper.find(。k -event-拖暗示无效时隙) )addClass(;
}
},
save:function(e){
if(e.event.meetinID = 1){
e.preventDefault();
}
},
edit:function(e){
if(e.event.meetinID = 1){
e.preventDefault();
}
}

我已经根据您的条件更新了Kendo Restriction示例: 演示


I am working with Kendo UI, js and the scheduler component.

My question is, if there is a way to disable a specific event from scheduler.

I find this, but this disables all events in scheduler. I want to disable just a specific event. The code should be something like this>

function disableEvents()
{
    var data = $("#scheduler").data("kendoScheduler").dataSource.data();
    data.forEach(function(event){
          if(event.ID='2') 
          {
               event.disable = true; //I have tried with event.editable = true;
          }
    });
}

I can't find the property editable nor disable, or something like that. Maybe there is a way to disable it using jquery. Can anybody help me?

Thank you!

解决方案

You will need to implement all the events specified in the restriction example of Kendo and preventDefault behaviour where ever your condition is not successfully.

For reference: Kendo Restriction Events Description.

You will need to take care of all the events (i.e. edit, save, resize, move) if you want to disable any event from any changes. The events are as below:

    resize: function(e) {
        if (e.event.meetingID = 1) {
            this.wrapper.find(".k-marquee-color").addClass("invalid-slot");
            e.preventDefault();
        }
    },
    move: function(e) {
        if (e.event.meetingId = 1) {
            this.wrapper.find(".k-event-drag-hint").addClass("invalid-slot");
        }
    },
    save: function(e) {
        if (e.event.meetinID = 1) {
            e.preventDefault();
        }
    },
   edit: function (e) {
        if (e.event.meetinID = 1) {
            e.preventDefault();
        }
    }

I have updated the Kendo Restriction example with your condition: Demo

这篇关于有没有办法禁用kendo ui调度程序中的特定事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆