onBeforeLightbox
Description
在用户打开 lightbox(编辑表单)之前立即触发
onBeforeLightbox: (id: string | number) => boolean;
Parameters
id- (required) string | number - 任务 ID
Returns
result- (boolean) - 定义事件的默认行为是否会被触发(true)或取消(false)
Example
gantt.attachEvent("onBeforeLightbox", function(id) {
const task = gantt.getTask(id);
task.my_template = `<span id='title1'>Holders: </span>${task.users}
<span id='title2'>Progress: </span>${task.progress*100}%`;
return true;
});
Related samples
Details
- 该事件是可阻塞的。返回 false 以取消默认处理(打开 lightbox)。
- 使用此事件是自定义 lightbox 中某些内容的一个好方法。
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.