moveTask

将任务移动到不同的位置

boolean | void moveTask(string | number sid,number tindex, [string | number parent] );
sidstring | number要移动的任务标识符
tindexnumber目标位置索引,任务将被放置在此处
(分支内的索引)
parentstring | number父节点ID。如果提供,tindex表示在该
'parent' 分支内的索引
boolean | void如果通过 onBeforeTaskMove 事件取消移动,则返回 `false`,否则返回 `undefined`

Example

const tasks = {
  data:[
     {id:"p_1", text:"项目 #1", start_date:"01-04-2023", duration:18, 
     open:true},
     {id:"t_1", text:"任务 #1", start_date:"02-04-2023", duration:8,
     parent:"p_1"},
     {id:"t_2", text:"任务 #2", start_date:"11-04-2023", duration:8,
     parent:"p_1"}
   ]
};
gantt.init("gantt_here");
gantt.parse(tasks);
 
gantt.moveTask("t_1", 1); //-> 这将把任务 "t_1" 移动到根级别

See also
Back to top