跳到主要内容

isCriticalTask

信息

此功能仅在 PRO 版中可用。

Description

检查指定任务是否为关键任务

isCriticalTask: (task: Task) => boolean

Parameters

  • task - (required) Task - 任务对象

Returns

  • value - (boolean) - 'true' 表示指定的任务是关键任务, 'false' 表示否则

Example

const tasks = {
data:[
{id:1, text:"Project #1", start_date:"01-04-2023", duration:18, type:"project"},
{id:2, text:"Task #1", start_date:"02-04-2023", duration:8, parent:1},
{id:3, text:"Task #2", start_date:"13-04-2023", duration:8, parent:1}
],
links:[
{id:1, source:1, target:2, type:"1"},
{id:2, source:2, target:3, type:"0"}
]
};

gantt.config.highlight_critical_path = true; /*!*/
gantt.init("gantt_here");
gantt.parse(tasks);

gantt.isCriticalTask(gantt.getTask(2));// ->'false' /*!*/
gantt.isCriticalTask(gantt.getTask(3));// ->'true' /*!*/

Details

注释

此方法在 critical_path 扩展中定义,因此您需要激活 critical_path 插件。请在 Critical Path 文章中阅读详细信息。

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.