이 컨트롤은 작업의 시작일과 종료일을 지정하여 작업의 기간을 설정할 수 있는 두 개의 선택기를 제공합니다.
gantt.config.lightbox.sections=[
{name:"description", height:70, map_to:"text", type:"textarea", focus:true},
{name:"time", height:72, map_to:"auto", type:"time"} ];
time 컨트롤을 라이트박스에 포함하려면 다음과 같이 하세요:
1) 라이트박스 설정에 섹션을 추가합니다:
gantt.config.lightbox.sections=[
{name:"description", height:70, map_to:"text", type:"textarea",focus:true},
{name:"period", height:72, map_to:"auto", type:"time"}, ];
2) 해당 섹션의 레이블을 지정합니다:
gantt.locale.labels.section_period = "Time period";
'time' 컨트롤에서 자주 사용되는 주요 속성은 다음과 같습니다 (전체 목록은 여기에서 확인할 수 있습니다):
"duration" 또는 "time" 섹션의 선택기를 사용자 정의하려면 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:"time", 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: "deadline", height: 72, type: "time", map_to:{start_date:"planned_start",end_date:"planned_end"}} ];
Related sample: Displaying deadlines
map_to의 객체 형태는 다음을 지원합니다:
속성이 생략되면 해당 컨트롤은 필수 날짜 속성을 사용합니다.
type:"time_optional"과 button: true를 라이트박스 섹션 설정에 지정하여 time 섹션의 표시 여부를 제어할 수 있습니다:
gantt.config.lightbox.sections = [
{name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
{name: "time", map_to: "auto", button: true, type: "time_optional"} ];
또한 토글 버튼 상태의 레이블을 정의하세요:
gantt.locale.labels.time_enable_button = 'Schedule';
gantt.locale.labels.time_disable_button = 'Unschedule';
섹션 옆에 토글 버튼이 표시되어, 사용자가 해당 섹션을 표시하거나 숨길 수 있습니다. 표시 상태에서는 type:"time"과 동일하게 동작합니다.
버튼이 비활성화되면 섹션이 숨겨지지만 즉시 변경 사항은 없습니다. "Save"를 클릭하면 time 컨트롤과 map_to로 연결된 작업 속성이 null
로 설정됩니다.
gantt.getTask(1);
// 반환값
{
id: '1', text: 'Task #1', unscheduled: true,
duration: 0, parent: '10',
end_date: null, start_date: null,
...
}
이 기능은 작업을 미예약(unscheduled) 상태로 표시할 때 유용합니다. 관련 예시는 다음을 참고하세요:
Related sample: Unscheduled tasks
Back to top