跳到主要内容

onBeforeBranchLoading

Description

如果启用动态加载,在用户展开任务分支后但加载开始之前触发

onBeforeBranchLoading: (settings: any) => boolean;

Parameters

  • settings - (required) object - 一个包含任务ID和请求URL的对象

Returns

  • result - (boolean) - 返回 false 将取消动态加载,数据请求将不会发送到服务器

Example

gantt.attachEvent("onBeforeBranchLoading", function(settings){
var task = gantt.getTask(settings.taskId);
config.url += "&value=" + encodeURIComponent(task.text);
return true;
});

Details

此事件可用于向动态加载请求添加额外参数。settings 对象包含两个属性——任务的 id 和请求 url:

{
taskId: 1,
url:"/data?parent_id=1"
}

可以在代码中修改请求 url。

此事件仅在启用 动态加载 时触发。

此事件是可拦截的,返回 false 将取消动态加载请求。

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.