본문으로 건너뛰기

onTaskCreated

Description

그리드에서 '+' 버튼을 눌러 사용자가 새 작업을 만들거나, createTask 메서드가 호출될 때 발생합니다

onTaskCreated: (task: Task) => boolean;

Parameters

  • task - (필수) Task - 새 작업의 객체

Returns

  • result - (boolean) - 반환값이 false인 경우 새 작업의 생성을 취소하고, true를 반환하면 기본 처리가 계속됩니다

Example

gantt.attachEvent("onTaskCreated", function(task){
task.projectId = 1;
return true;
});

Details

이벤트는 새 작업이 화면에 표시되기 전에 발생합니다. 이를 통해 기본값을 설정하거나 작업 생성 자체를 취소할 수 있습니다.

이벤트가 트리거될 때까지 새 작업은 getTask 메서드를 통해 데이터 저장소에서 이미 사용 가능하게 되어 있습니다.

이벤트 핸들러가 false를 반환하면 작업은 데이터 저장소에서 제거되고 onAfterTaskDelete 이벤트가 트리거되지 않습니다.

createTask 메서드로 작업을 생성할 때 발생하는 최종 이벤트 순서는 다음과 같습니다:

  1. onTaskCreated
  2. onBeforeLightbox
  3. onLightbox
  4. onAfterLightbox
  5. onAfterTaskAdd
  6. onBeforeTaskAdd
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.