项目管理工具DHTMLX Gantt灯箱元素配置教程:如何使用灯箱元素(下)

1、隐藏部分章节

要使某个章节对特定事件隐藏,重定义它的set_value方法如下:

gantt.form_blocks.textarea.set_value=function(node,value,ev){    node.firstChild.value=value||"";    var style = ev.some_property":"none";    node.style.display=style; // editor area    node.previousSibling.style.display=style; //section header    gantt.resizeLightbox(); //correct size of lightbox}
2、将章节和标签设置在同一行上

通过设置wide_form配置选项为true,你可以将lightbox的部分与它们的标签放在同一行上:

gantt.config.wide_form = true;gantt.locale.labels.section_priority = "Priority";gantt.locale.labels.section_status = "Status";gantt.config.lightbox.sections = [    {name: "description", height: 38, map_to: "text", type: "textarea", focus: true},    {name: "status", height:22, map_to: "status", type: "select", options: [         {key:1, label: "New"},                                                       {key:2, label: "Open"},                                                     {key:3, label: "Done"}                                                  ]},                                                                        {name: "priority", map_to: "priority", type: "radio", options: [        {key: 1, label: "High"},        {key: 2, label: "Normal"},        {key: 3, label: "Low"},    ]},    {name: "time", type: "duration", map_to: "auto"}];gantt.init("gantt_here");
3、顶部按钮设自定义置

可以在section头中设置一个自定义按钮。按以下步骤向section的头部添加按钮:

在section对象中指定button属性:

{name:"description", height:130, map_to:"text", type:"textarea", button:"help"}

为按钮设置标签:

//'help' is the value of the 'button' propertygantt.locale.labels.button_help="Help label";

指定按钮点击的处理程序:

gantt.form_blocks.textarea.button_click = function(index,button,shead,sbody){    // any custom logic}

设置地址:

  • Index -(编 )节索引。从零开始的编
  • button – (HTMLElement)按钮的HTML元素
  • header – (HTMLElement) section头的HTML元素
  • sbody – (HTMLElement) section主体的HTML元素

你可以通过下面的CSS类来定义按钮的图像:

.dhx_custom_button_help{    background-image:url(imgs/but_help.gif);}

DHTMLX Gantt享有超十年声誉,支持跨浏览器和跨平台,性价比高,可满足项目管理控件应用的所有需求,是最完善的甘特图图表库。2022年终狂欢火热进行中,知名软控件产品享超低折扣,满额豪礼赠,复购双重大礼!了解更多内容,欢迎在线咨询或者私信我获取正版试用版及 价。


甘特图控件交流群:764148812    欢迎进群交流讨论

年终狂欢季,全场产品,限时特惠,立即了解详情!

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年10月13日
下一篇 2022年10月13日

相关推荐

发表回复

登录后才能评论