跳到主要内容

timeline_cell_class

Description

定义应用于 timeline 区域单元格的 CSS 类

timeline_cell_class: (item: any, date: Date) => string | void;

Parameters

  • item - (required) Task | object - 与行关联的任务或资源对象
  • date - (required) Date - 单元格对应的具体日期

Returns

  • text - (string | void) - 给定 item 对应的 CSS 类名

Example

<style>
.weekend{ background: #f4f7f4 !important;}
</style>

gantt.templates.timeline_cell_class = function(task,date){
if(date.getDay()==0||date.getDay()==6){
return "weekend";
}
};

Details

在处理工作时间计算时,推荐使用 isWorkTime 而非固定值:

gantt.config.work_time = true;

gantt.templates.timeline_cell_class = function(task,date){
if(!gantt.isWorkTime({task:task, date:date}))
return "weekend";
};