이 섹션에서는 작업의 시작 날짜와 기간(일수)을 지정하여 작업의 기간을 설정할 수 있는 셀렉터 세트를 소개합니다.
gantt.config.lightbox.sections=[
{name:"description", height:70, map_to:"text", type:"textarea", focus:true},
{name:"time", height:72, map_to:"auto", type:"duration"} ];
Related sample: Basic initialization
기본적으로 lightbox에는 하나의 duration 컨트롤이 포함되어 있습니다. 여러 개를 추가하려면 다음 단계를 따르세요:
1) lightbox 설정에 새 섹션을 추가합니다:
gantt.config.lightbox.sections=[
{name:"description", height:70, map_to:"text", type:"textarea",focus:true},
{name:"time2", height:72, map_to:"auto", type:"duration"}, {name:"time", height:72, map_to:"auto", type:"duration"}
];
2) 새 섹션에 대한 라벨을 정의합니다:
gantt.locale.labels.section_time2 = "Actual duration";
time 컨트롤에서 자주 사용하는 주요 속성은 다음과 같습니다 (전체 목록은 여기에서 확인하세요):
"Time period" 섹션의 셀렉터는 time_format 속성을 사용하여 커스터마이즈할 수 있습니다 (날짜 형식 지정 참조):
Adding the time selector to the 'Time period' section
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
{name:"time",type:"duration",map_to:"auto",time_format:["%d","%m","%Y","%H:%i"]}];
time_format 배열에서 허용되는 요소:
이 요소들은 배열 내에서 순서를 바꾸거나 생략할 수 있지만, 데이터 형식 자체는 변경할 수 없습니다.
예를 들어, 다음과 같은 변형이 가능합니다:
// 시간 먼저
time_format:["%H:%i", "%m", "%d", "%Y"]
// 월 먼저
time_format:["%m","%d", "%Y", "%H:%i"]
// 연도 셀렉터 생략
time_format:["%H:%i", "%m", "%d"]
// 잘못된 사용 예시
time_format:["%H:%i", "%M", "%d", "%Y"] // "%m" 대신 "%M" 사용
일반적으로 time 및 duration 컨트롤은 map_to를 "auto" (map_to:"auto")로 설정하여 필수 'start_date' 및 'end_date' 속성과 연결됩니다.
컨트롤을 'start_date', 'end_date' 대신 커스텀 날짜 속성에 연결하려면 map_to 속성에 객체를 사용하세요:
gantt.config.lightbox.sections = [
{name: "description", height: 72, type: "textarea", map_to:"text", focus: true},
{name: "time", height: 72, type: "duration", map_to:"auto"},
{name: "baseline", height: 72, type: "duration", map_to:{start_date:"planned_start",end_date:"planned_end"}} ];
Related sample: Display baselines
map_to 객체는 다음 속성을 지원합니다:
속성이 생략된 경우, 컨트롤은 관련 필수 날짜 속성으로 기본 설정됩니다.
lightbox 섹션 설정에서 type:"duration_optional" 및 button: true로 duration 섹션의 표시 여부를 토글할 수 있습니다:
gantt.config.lightbox.sections = [
{name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
{name: "time", map_to: "auto", button: true, type: "duration_optional"} ];
또한 토글 버튼의 두 상태에 대한 라벨을 정의하세요:
gantt.locale.labels.time_enable_button = 'Schedule';
gantt.locale.labels.time_disable_button = 'Unschedule';
토글 버튼이 섹션 옆에 표시되어, 가시성을 전환할 수 있습니다. 표시 상태에서는 type:"duration"과 동일하게 동작합니다.
버튼을 끄면 섹션이 즉시 사라지지만, 저장 후 duration 컨트롤에 map_to로 매핑된 작업 속성은 null
로 설정됩니다.
gantt.getTask(1);
// 반환 예시
{
id: '1', text: 'Task #1', unscheduled: true,
duration: 0, parent: '10',
end_date: null, start_date: null,
...
}
이 기능은 UI에서 직접 작업을 미일정(unscheduled)으로 표시하거나, 기준선 없는 작업을 관리할 때 유용합니다. 관련 샘플을 참고하세요:
Related sample: Unscheduled tasks
Back to top