如何在Kendo Scheduler中设置事件颜色 [英] How to set the Event Color in Kendo Scheduler

查看:77
本文介绍了如何在Kendo Scheduler中设置事件颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Kendo UI的ASP.NET MVC包装器,并想实现Scheduler. 据我所知,事件的背景颜色由该事件使用的第一个资源的颜色确定.不使用资源时是否可以设置颜色?

I'm using the ASP.NET MVC Wrappers for Kendo UI and want to implement the Scheduler. As far as I gathered, the background color of an event is determined by the color of the first resource that the event uses. Is there a way to set the color when you are not using resources?

推荐答案

如果您不想使用资源,则可以使用 dataBound 事件

If you don't want to use resources you can use dataBound event http://docs.telerik.com/kendo-ui/api/web/scheduler#events-dataBound to set styles for each event manually, depending on some conditions

schedulerOptions = {
    date: new Date(),
    startTime: new Date(),
    height: 600,
    ...
    dataBound: function(e) {
        $('div.k-event').removeClass('special-event');
        e.sender._data.forEach(function(eventDetails) {            
            if (eventDetails['description'] === 'special event') {
                $('div.k-event[data-uid="'+eventDetails['uid']+'"]').addClass('special-event');
            }
        });
    }
};

这篇关于如何在Kendo Scheduler中设置事件颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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