1

如果我使用时间线视图,如何使周末的颜色与其他工作日不同?例如,如何将周末背景颜色更改为浅黄色。我尝试过使用它,但如果该月不包含事件,则颜色不会改变。

 scheduler.templates.timeline_cell_class = function(evs, x, y) {
                if (x.getDay() == 6 || x.getDay() == 0) {
                    return getWeekendClass();
                }
                };

var getWeekendClass = function() {
        return "weekend_cell";
    };
4

1 回答 1

5

如果您仍然需要答案,您唯一需要做的就是:

scheduler.addMarkedTimespan({
    days: [0, 6],   // Sunday and Saturday
    zones: "fullday",
    css: "scheduler_weekends"
});

其中 scheduler_weekends 类似于:

.scheduler_weekends {
    background-color: #FFFF00;
    opacity: 0.5;
}

这将在除月视图之外的所有视图中以黄色显示周末。为了让它在月视图中显示,您必须添加到您的 CSS:

.dhx_scheduler_month .dhx_marked_timespan { display: block; }
于 2015-04-21T17:02:07.817 回答