为了让用户注意特定的时间段,您可以突出显示它们。
- 要突出显示时间线区域的单元格,请使用timeline_cell_class模板。
- 要突出显示时间线时间刻度的单元格,请使用scale_cell_class模板。
模板是一个函数,它遍历所有日期并将指定的 CSS 类应用于相关单元格。

例如,您可以突出显示周末以直观地将比例划分为周:
<style>.weekend{ background: #f4f7f4 !important;}</style>gantt.templates.scale_cell_class = function(date){ if(date.getDay()==0||date.getDay()==6){ return "weekend"; }};gantt.templates.timeline_cell_class = function(task,date){ if(date.getDay()==0||date.getDay()==6){ return "weekend" ; }};gantt.init("gantt_here");
请注意,在使用工作时间计算时,您可以使用isWorkTime而不是硬编码值:
gantt.config.work_time = true;gantt.templates.scale_cell_class = function(date){ if(!gantt.isWorkTime(date)){ return "weekend"; }};gantt.templates.timeline_cell_class = function(task,date){ if(!gantt.isWorkTime({task:task, date:date})){ return "weekend" ; }};gantt.init("gantt_here");
dhtmlxGantt享有超十年声誉,支持跨浏览器和跨平台,性价比高,可满足项目管理控件应用的所有需求,是最完善的甘特图图表库。了解更多内容,欢迎在线咨询或者私信我获取正版试用版及 价。
甘特图控件交流群:764148812 欢迎进群交流讨论
年终狂欢季,全场产品,限时特惠,立即了解详情!
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!