How to set the Event Color in Kendo Scheduler

喜你入骨 提交于 2019-12-11 08:14:40

问题


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?


回答1:


According to the documentation here: http://docs.kendoui.com/getting-started/web/scheduler/resources...

If a resource instance has its color field set the scheduler will use this value as the background of all events assigned to that instance.

It seems that it will be the color that is assigned to the first single resource selected.




回答2:


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


来源:https://stackoverflow.com/questions/18629847/how-to-set-the-event-color-in-kendo-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!