定义应用于 timeline 区域单元格的 CSS 类
item | Task | object | 与行关联的任务或资源对象 |
date | Date | 单元格对应的具体日期 |
<style>
.weekend{ background: #f4f7f4 !important;}
</style>
gantt.templates.timeline_cell_class = function(task,date){
if(date.getDay()==0||date.getDay()==6){
return "weekend";
}
};
在处理工作时间计算时,推荐使用 isWorkTime 而非固定值:
gantt.config.work_time = true;
gantt.templates.timeline_cell_class = function(task,date){
if(!gantt.isWorkTime({task:task, date:date}))
return "weekend";
};