dhtmlx甘特图常用方法及基本配置集合甘特图基本配置
gantt.plugins({tooltip:true,Quick_info:true,//快速信息框//multiselect:true,//激活多任务选择});
甘特.config.tooltip_offset_x=10;甘特.config.tooltip_offset_y=30;
gantt.config.open_split_tasks=true;
gantt.config.details_on_create=true;
甘特.config.autofit=true;
gantt.config.resize_rows=true;
gantt.config.open_tree_initially=true;
gantt.plugins({tooltip:true,Quick_info:true,//快速信息框});gantt.config.show_quick_info=true;
甘特.config.sort=true;
甘特.config.row_height=44;
gantt.config.drag_project=true;
甘特.config.scale_height=40;
gantt.config.start_date=newDate(`${newDate().getFullYear()-2},${newDate().getMonth()},${newDate().getDay()}`)gantt.config.end_date=newDate(`${newDate().getFullYear()+2},${newDate().getMonth()},${newDate().getDay()}`)gantt.config.show_tasks_outside_timescale=true
gantt.config.scales=[{unit:'年',step:1,format:'%Y'},{unit:'月',step:1,format:'%M'},];
gantt.templates.task_text=function(start,end,task){return`spanstyle='margin-left:10px;color:white;'${task.text}/span`;};
gantt.templates.lightbox_header=function(start_date,end_date,task){return`b${task.text}/b`};
【自定义元素的详细配置方法在另一篇文章中有讲解】
gantt.config.lightbox.sections=[{name:'描述',height:36,map_to:'文本',type:'textarea',focus:true,},{name:'时间',type:'持续时间',map_to:'自动'},{name:'参与者',height:36,map_to:'参与者',type:'ParticipantsPlan',focus:true,},{name:'BgColor',height:36,map_to:'颜色',type:'ParticipantsPlanColor',focus3第3360章
//配置任务灯箱gantt.config.lightbox.project_sections=[{name:'description',height:70,map_to:'text',type:'textarea',focus:true},{name:'type',type:'typeselect',map_to:'类型'},{name:'时间',type:'持续时间',readonly:true,map_to:'自动'}];//配置里程碑灯箱gantt.config.lightbox.milestone_sections=[{name:'description',height:70,map_to:'text',type:'textarea',focus:true},{name:'type',type:'typeselect',map_to:'类型'},{name:'时间',type:'持续时间',single_date:true,map_to:'自动'}];
gantt.templates.grid_row_class=function(start,end,task){console.log('网格类',start,end,task);};
gantt.templates.date_grid=function(date,task,column){console.log('日期网格',date,task,column)if(taskgantt.isUnscheduled(task)gantt.config.show_unscheduled){return甘特.模板.task_unscheduled_time(任务);}其他{返回gantt.templates.grid_date_format(日期);}}
gantt.templates.grid_indent=function(item){return'divclass='gantt_tree_indent'style='display:none'/div'}
【自定义元素的详细配置方法在另一篇文章中有讲解】
gantt.config.columns=[{name:'文本',label:'任务名称',tree:true,width:'*'},{name:'开始日期',label:'开始时间',align:'中心'},{name:'持续时间',label:'持续时间',align:'中心'},{name:'添加',label:''}];
gantt.templates.task_date=function(date){returngantt.date.date_to_str(gantt.config.task_date)(date);};
【该功能为扩展功能,需要单独配置】
甘特.插件({tooltip:true});
gantt.templates.tooltip_text=函数{return('btitle:/b'+task.text+'br/spanstart:/span'+gantt.templates.tooltip_date_format(start)+'br/spanend:/span'+gantt.templates.tooltip_date_format(end)+'br/span进度:/span'+Math.round(task.progress*100)+'%');};
Gantt内置方法
【返回true表示执行,默认即可,如果需要自定义返回fasle。内置方法不会被执行]
gantt.attachEvent('onTaskDblClick',function(id,e){returntrue})
gantt.attachEvent('onAfterTaskAdd',function(id,item){returntrue})
gantt.attachEvent('onTaskSelected',function(id){returntrue})
gantt.attachEvent('onMouseMove',function(id,e){})
gantt.attachEvent('onAfterTaskDrag',function(id,mode,e){returntrue})
gantt.attachEvent('onTaskCreated',function(task){returntrue})
gantt.attachEvent('onBeforeLightbox',function(id){returntrue})
gantt.templates.progress_text=function(start,end,task){returnMath.round(task.progress*100)+'%';};
gantt.templates.drag_link=function(from,from_start,to,to_start){console.log('拖动自',from,from_start,to,to_start);//返回文本;};
gantt.templates.drag_link_class=function(from,from_start,to,to_start){console.log('from',from,from_start,to,to_start);};
以上是项目中用到的一些方法。详细信息请查看官方文档。
甘特图文档
大家好,今天小编关注到一个比较有意思的话题,就是关于电脑培训班用什么配置电脑的问题,于是小编就整理了4个相关介绍电脑培训班用什么配置电脑的解答,让我们一起看看吧…
大家好,今天小编关注到一个比较有意思的话题,就是关于电脑培训室空调配置的问题,于是小编就整理了5个相关介绍电脑培训室空调配置的解答,让我们一起看看吧。医院空调配…
大家好,今天小编关注到一个比较有意思的话题,就是关于渲染效果图电脑培训的问题,于是小编就整理了1个相关介绍渲染效果图电脑培训的解答,让我们一起看看吧。消防培训开…
大家好,今天小编关注到一个比较有意思的话题,就是关于怎么看电脑培训配置的问题,于是小编就整理了3个相关介绍怎么看电脑培训配置的解答,让我们一起看看吧。三维建模电…
大家好,今天小编关注到一个比较有意思的话题,就是关于兰州配置电脑培训班的问题,于是小编就整理了5个相关介绍兰州配置电脑培训班的解答,让我们一起看看吧。兰州一中致…
2024-10-23 08:24:04
2024-10-23 06:15:33
2024-10-23 04:24:04
2024-10-23 02:33:07
2024-10-23 01:01:19
大家好,今天小编关注到一个比较有意思的话题,就是关于聊城电脑培训班在哪啊的问题,…
大家好,今天小编关注到一个比较有意思的话题,就是关于学电脑专业爸妈不给买电脑的问…