跳到主要内容

timeline_placeholder

Description

当timeline为空时显示背景grid

timeline_placeholder: boolean

Example

gantt.config.timeline_placeholder = false;
...
gantt.init("gantt_here");

Details

当Gantt中没有加载任何任务时,timeline中会显示背景grid:

background grid

如果包含任务的行没有覆盖整个timeline,也会显示背景grid:

background grid

为了突出显示背景grid中的列和单元格,可以使用 timeline_cell_class 模板:

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

对于背景行,会传入一个临时的task对象给模板。可以通过其id来识别该对象:

if(task.id === "timeline_placeholder_task"){
...
}

Change log

  • added in v8.0