将任务移动到不同的位置
sid | string | number | 要移动的任务标识符 |
tindex | number | 目标位置索引,任务将被放置在此处 (分支内的索引) |
parent | string | number | 父节点ID。如果提供,tindex表示在该 'parent' 分支内的索引 |
boolean | void | 如果通过 onBeforeTaskMove 事件取消移动,则返回 `false`,否则返回 `undefined` |
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" 移动到根级别