1. 获取任务节点
    https://docs.dhtmlx.com/gantt/api__gantt_gettask.html
gantt.addTask({id:7,text:"Task #5",start_date:"02-09-2013",duration:28
}, "pr_2");gantt.getTask(7);
//->{id:7, text:"Task #5", start_date:"02-09-2013", duration:28,
//   parent:"pr_2", $source:[1,5], $target:[8,13], ...}
  1. 返回下一项的 id(无论嵌套级别如何:相同或不同)
    https://docs.dhtmlx.com/gantt/api__gantt_getnext.html
在这里插入代码片
  1. 返回下一项的 id(无论嵌套级别如何:相同或不同)
    https://docs.dhtmlx.com/gantt/api__gantt_getparent.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};
gantt.init("gantt_here");
gantt.parse(tasks);gantt.getParent("t_1"); //-> "p_1"
gantt.getParent("p_1"); //-> 0 (the default root id)
  1. 返回任务栏的 HTML 元素
    https://docs.dhtmlx.com/gantt/api__gantt_gettasknode.html
gantt.addTask({id:10,text:"Task #5",start_date:"02-09-2013",duration:28
}, "project_2");gantt.getTaskNode(10);//-><div task_id=​"2" class=​"gantt_task_line" ​…​​>​​…​</div>​
  1. 返回表格中任务行的 HTML 元素
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskrownode.html
var taskId = gantt.addTask({id:10,text:"Task #5",start_date:"02-09-2013",duration:28
}, "project_2");gantt.getTaskRowNode(10);//-><div class=​"gantt_row" task_id=​"2">​…​</div>​
  1. 按指定条件查找任务
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskby.html
// simple search
var userTasks = gantt.getTaskBy("user_id", 5);// (task: object) => boolean
var userTasks = gantt.getTaskBy(function(task){return task.user_id == 5 || !task.user_id;
});var userTasks = gantt.getTaskBy(task => task.user_id == 5);
  1. 通过 WBS 代码返回任务
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskbywbscode.html
var task = gantt.getTaskByWBSCode("1.2");
// => {id:"t1", text:"Task #1, unscheduled: true, duration: 1, …}
  1. 返回任务的 WBS 代码(大纲编号)
    https://docs.dhtmlx.com/gantt/api__gantt_getwbscode.html
gantt.init("gantt_here");gantt.parse({"data":[{"id":1, "text":"Project #1", "start_date":"28-03-2013", "duration":"11", "parent":"0", "open": true},{"id":2, "text":"Task #1", "start_date":"01-04-2013", "duration":"18", "parent":"1"},{"id":3, "text":"Task #2", "start_date":"02-04-2013", "duration":"8", "parent":"1"}],"links":[]
});var wbs_code = gantt.getWBSCode(gantt.getTask(3)) // -> returns "1.2"
  1. 通过其全局任务索引返回任务
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskbyindex.html
var globalTaskIndex = gantt.getGlobalTaskIndex(19); // -> 10var task = gantt.getTaskByIndex(10);
// -> {id:"19", text:"Task name", type:"project", order:"10", progress:0.4, …}
  1. 返回指定时间段内发生的任务的集合
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskbytime.html
var tasks = gantt.getTaskByTime(new Date(2013,3,10),new Date(2013,4,10));
for (var i=0; i<tasks.length; i++){alert(tasks[i].text);
}
// or
var tasks = gantt.getTaskByTime();//returns all tasks
  1. 返回指定父分支的一级子任务
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};
gantt.init("gantt_here");
gantt.parse(tasks);gantt.getChildren("p_1");//->["t_1", "t_2"]
  1. 检查当前是否选择了指定的任务
    https://docs.dhtmlx.com/gantt/api__gantt_isselectedtask.html
gantt.templates.task_class =
gantt.templates.grid_row_class =
gantt.templates.task_row_class = function (start, end, task) {if (gantt.isSelectedTask(task.id))return "gantt_selected";
};
  1. 检查指定的任务是否存在
    https://docs.dhtmlx.com/gantt/api__gantt_istaskexists.html
    添加新任务
    https://docs.dhtmlx.com/gantt/api__gantt_addtask.html
gantt.addTask({id:10,text:"Task #5",start_date:"02-09-2013",duration:28
}, "project_2");gantt.isTaskExists(10); // ->true
  1. 检查指定任务当前是否在甘特图中呈现
    https://docs.dhtmlx.com/gantt/api__gantt_istaskvisible.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};
gantt.init("gantt_here");
gantt.parse(tasks);gantt.isTaskVisible("t_1"); // ->true
  1. 返回时间刻度的配置
    https://docs.dhtmlx.com/gantt/api__gantt_getscale.html
gantt.getScale();
  1. 获取甘特图中当前加载的任务数
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskcount.html
gantt.getTaskCount();
  1. 获取分支中任务的索引
    https://docs.dhtmlx.com/gantt/api__gantt_gettaskindex.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};
gantt.init("gantt_here");
gantt.parse(tasks);var taskIndex = gantt.getTaskIndex("t_1"); // -> 0
var globalTaskIndex = gantt.getGlobalTaskIndex("t_1"); // -> 1
  1. 返回任务的类型
    https://docs.dhtmlx.com/gantt/api__gantt_gettasktype.html
var type = gantt.getTaskType(gantt.getTask(12));
  1. 返回数据存储的配置对象
    https://docs.dhtmlx.com/gantt/api__gantt_getdatastore.html
var tasksStore = gantt.getDatastore("task");
//获取所有的ID
gantt.getDatastore("task").fullOrder
//获取所有节点
gantt.getDatastore("task").pull
  1. 返回当前选定任务的数组
    https://docs.dhtmlx.com/gantt/api__gantt_getselectedtasks.html
gantt.getSelectedTasks();
// 这个方法是在multiselect扩展中定义的,所以需要激活multiselect插件。
gantt.plugins({multiselect: true
});
gantt.config.multiselect = true; // 多选
  1. 返回所选任务的 id
    https://docs.dhtmlx.com/gantt/api__gantt_getselectedid.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8, parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8, parent:"p_1"}]
};gantt.init("gantt_here");
gantt.parse(tasks);gantt.selectTask("t_1");
gantt.getSelectedId(); // -> "t_1"
  1. 选择指定的任务
    https://docs.dhtmlx.com/gantt/api__gantt_selecttask.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8, parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8, parent:"p_1"}]
};gantt.init("gantt_here");
gantt.parse(tasks);gantt.selectTask("t_1");// 该方法调用onTaskSelected事件。
gantt.attachEvent("onTaskSelected", function(id){//any custom logic here
});
  1. 检查指定项目是否有子任务
    https://docs.dhtmlx.com/gantt/api__gantt_haschild.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};
gantt.init("gantt_here");
gantt.parse(tasks);gantt.hasChild("p_1"); //-> true gantt.hasChild("t_1"); //-> false
  1. 获取屏幕上可见的任务数(未折叠的任务)
    https://docs.dhtmlx.com/gantt/api__gantt_getvisibletaskcount.html
gantt.getVisibleTaskCount();
  1. 更新指定的任务
    https://docs.dhtmlx.com/gantt/api__gantt_updatetask.html
var taskId = gantt.addTask({id:10,text:"Task #10",start_date:"02-04-2013",duration:8,parent:1
});gantt.getTask(taskId).text = "Task #13"; //changes task's data
gantt.updateTask(taskId); //renders the updated taskgantt.attachEvent("onAfterTaskUpdate", function(id,item){//any custom logic here
});
  1. 打开具有指定 id 的分支
    https://docs.dhtmlx.com/gantt/api__gantt_open.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};gantt.init("gantt_here");
gantt.parse(tasks);
gantt.open("p_1");gantt.attachEvent("onTaskOpened", function(id) {//any custom logic here
});
  1. 关闭具有指定 id 的分支
    https://docs.dhtmlx.com/gantt/api__gantt_close.html
var tasks = {data:[{id:"p_1", text:"Project #1", start_date:"01-04-2013", duration:18, open:true},{id:"t_1", text:"Task #1", start_date:"02-04-2013", duration:8,parent:"p_1"},{id:"t_2", text:"Task #2", start_date:"11-04-2013", duration:8,parent:"p_1"}]
};
gantt.init("gantt_here");
gantt.parse(tasks);gantt.close("p_1");gantt.attachEvent("onTaskClosed", function(id) {alert("You've closed a branch with id="+id);
});
  1. 删除指定的任务
    https://docs.dhtmlx.com/gantt/api__gantt_deletetask.html
gantt.addTask({id:10,text:"Project #1",start_date:"02-09-2013",duration:28
});gantt.deleteTask(10);
gantt.attachEvent("onBeforeTaskDelete", function(id,item){//any custom logic herereturn true;
});
gantt.attachEvent("onAfterTaskDelete", function(id,item){//any custom logic here
});

4、Gantt 任务节点部分相关推荐

  1. 2021秋招学习笔记

    PS:csdn上有很多图片加载不出来,有PDF版在我的资源.(如果没有1积分可以评论我,直接发给你邮箱) 文章目录 Java基础篇学习(7/3-7/4) 数据类型 泛型.反射.注解.序列化(加实例) ...

  2. gantt project 使用

    市场上有不少项目计划类系统, 很多都是收费的, 还有很多都是web版, 这些都自然被排除了. 免费好用的还真不多, 今天简单介绍一下 gantt project 这个软件, 开源并且免费, 基于 ja ...

  3. bootstrap-table 新增可编辑行_现代Web开发堆栈工具DevExtreme 新增Gantt组件,助力项目管理...

    点击"了解更多"获取DevExpress DevExtreme v19.2正式版下载 DevExtreme拥有高性能的HTML5 / JavaScript小部件集合,使您可以利用现 ...

  4. Redmine Gantt 实现 (Show relations in Gantt diagram)

    Redmine 是一个比较强大的项目工具,里面的Gantt的选项,看起来好像功能不强,其实是很多默认的选项没有打开. 本文,提及在redmine中实现甘特图的各个任务的关联,这样就可以不用在某一个项目 ...

  5. Bryntum Gantt 5.0 JS

    最快的JS甘特图 Bryntum Gantt 是一个超级快速且完全可定制的甘特图套件,适用于您的 React / Angular / Vue / JS 应用程序. 闪电般的快 甘特图是用纯 JavaS ...

  6. Bryntum Gantt 5.2.2 New-Crack

    最快的JS甘特图----------最新版本 5.2.2 11 月 8 日 Bryntum Gantt 是一个超级快速且完全可定制的甘特图套件,适用于您的 React / Angular / Vue ...

  7. Gantt(甘特图)与PERT(项目计划评审技术)图各自的缺陷

    文章目录 1 Gantt(甘特图) 2 PERT(项目计划评审技术)图 3 考题 1 Gantt(甘特图) 甘特图,也称为条状图(Bar chart).是在1917年由亨利·甘特开发的,其内在思想简单 ...

  8. Gantt图和PERT图的相关知识

    1.Gantt 图 Gantt图以时间为基准描述项目任务,可以清晰的描述每个任务从何时开始,到何时结束,以及每个任务的并行关系,但是不能反映项目各任务之间的依赖关系,也无法确定整个任务的关键所在. 2 ...

  9. tree父节点不被选中和勾选(所以父节点)只选择子节点

    tree父节点不被选中和勾选(所以父节点)只选择子节点 t = $.fn.zTree.init(t, setting, result); var zTree = $.fn.zTree.getZTree ...

最新文章

  1. 设置显示VSCode的修改历史Local History,方便多人开发的时候快速查看谁修改了代码(也可以防止误删代码文件)
  2. 一般实现分布式锁都有哪些方式?
  3. MS:中山大学丁涛/吴忠道-肠道菌群调控血吸虫病传播媒介光滑双脐螺适生性的新机制...
  4. 第七章 PX4-Pixhawk-Mavlink解析
  5. iphone4基本操作
  6. ---WebCam网络摄像头11 http协议
  7. SpringCloud(三) Eureka之服务注册发现以及实现工程间调用
  8. 又要辞职了,又要换工作了
  9. 跟零计算机基础的房东女儿讲了一下午的中间人劫持京东事件后,她感激涕零,决定给我免除房租......
  10. 教女朋友用Python快速绘制图表
  11. android蓝牙浅析
  12. 首创Domino前后端彻底分离,结合vue、react优美例子
  13. nexus上传jar总是读条而上传不成功的问题
  14. SQL Server 2008 (2008 R2) 清理日志方法
  15. 绘制y=sin(x)/x的图形
  16. 如何生成和使用CLIPS动态链接库
  17. 使用有赞商城API新增商品
  18. 绩效管理的目的和目标
  19. mysql锁描述正确的是_MySQL表锁详解
  20. (导航页)OpenStack-M版-双节点手工搭建-附B站视频

热门文章

  1. linux关触摸屏命令,Linux 禁用触摸屏 触摸板
  2. Java通过HAPI解析HL7消息
  3. 2022总结,强风吹拂
  4. 解决kettle部署在linux中界面变成英文的问题
  5. Axure8元件库.rplib(Iaxure)
  6. JAVA 编写一个员工类,成员变量和成员方法自拟,编写一个测试类
  7. SPOOLING系统
  8. 手机通过IPV6访问电脑共享文件
  9. OpenGL ES 简介
  10. 什么是动态代理,动态代理的应用有哪些