이 컨트롤은 작업의 상위 항목을 변경할 수 있는 선택 박스를 제공합니다. 간트 차트에 표시된 모든 작업을 불러오며, 필터링 규칙을 적용하거나 값 표시 방식을 사용자화할 수 있습니다. 이러한 기능 외에는 Select Control 컨트롤과 동일하게 동작합니다.
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
{name:"parent", type:"parent", allow_root:"true", root_label:"No parent"}, {name:"time", height:72, type:"time", map_to:"auto"}
];
Related sample: Parent selector
parent 컨트롤을 라이트박스에 포함하려면 다음과 같이 하세요:
1) 라이트박스 설정에 섹션을 추가합니다:
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea",focus:true},
{name:"parent", type:"parent", allow_root:"true", root_label:"No parent"}, {name:"time", height:72, type:"duration", map_to:"auto"}
];
2) 해당 섹션에 라벨을 정의합니다:
gantt.locale.labels["section_parent"] = "Parent task";
Related sample: Parent selector
parent 컨트롤에서 자주 사용되는 주요 속성은 다음과 같습니다(전체 목록은 여기에서 확인하세요):
parent 컨트롤에 표시되는 옵션을 제어하려면 filter 속성을 사용하세요:
Filtering. Displaying only tasks of the 1st level
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
{name:"parent", type:"parent", filter:function(id, task){ if(task.$level > 1){ return false; }else{ return true; } }},
{name:"time", height:72, type:"time", map_to:"auto"}
];
Related sample: Parent selector
filter 함수는 두 개의 파라미터를 받습니다:
그리고 다음을 반환합니다:
parent 컨트롤의 옵션 순서를 지정하려면 sort 속성을 사용하세요:
Sorting tasks by the title's length
function sortByLength(a,b){
a = a.text.length();
b = b.text.length();
return a>b?1:(a<b?-1:0);
};
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
{name:"parent", type:"parent", sort:sortByLength}, {name:"time", height:72, type:"time", map_to:"auto"}
];
sort 함수는 인접한 두 항목을 비교하여 다음 값을 반환합니다:
parent 컨트롤에서 옵션의 표시 방식을 사용자화하려면 template 속성을 사용하세요:
gantt.config.lightbox.sections = [
{name:"description", height:38, map_to:"text", type:"textarea", focus:true},
{name:"parent", type:"parent", template(start,end,ev){ var title = ev.id+"."+ev.text; return title; }}, {name:"time", height:72, type:"time", map_to:"auto"}
];
template 함수는 세 가지 파라미터를 받습니다:
그리고 컨트롤에 표시할 포맷된 옵션을 반환합니다.
'template' 속성이 지정되지 않은 경우, 옵션은 task_text 템플릿에 따라 포맷됩니다.