跳到主要内容

链接属性

在本页面,你将看到链接对象可能包含的所有属性的完整列表。

任务对象的完整属性列表请参阅 任务属性 文章。

必填属性

名称类型描述
idstring | number链接的 id
sourcestring | number依赖关系将从该任务的 id 开始
targetstring | number依赖关系将以该任务的 id 结束
typestring依赖类型。可用值存储在 links 对象中。默认值为:
  • "0" - 'finish_to_start'.
  • "1" - 'start_to_start'.
  • "2" - 'finish_to_finish'.
  • "3" - 'start_to_finish'.

如果你想以除了默认值 ('0','1','2') 之外的方式存储依赖类型,可以修改 links 对象的相关属性的值。举例:

gantt.config.links.start_to_start = "start2start";

注意,这些值仅影响依赖类型的存储方式,而不影响可视化的行为。

可选属性

名称类型描述
lagnumber任务的滞后时间
readonlyboolean可以将链接标记为 只读
editableboolean可以将链接标记为 可编辑

示例

var data = {
tasks: [
{id:1, text:"Project #1", start_date:"01-04-2020", duration:18},
{id:2, text:"Task #1", start_date:"02-04-2020", duration:8, parent:1},
{id:3, text:"Task #2", start_date:"11-04-2020", duration:8, parent:1}
],
links:[
{id:1, source:1, target:2, type:"1"},
{id:2, source:2, target:3, type:"0"}
]
};
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.