Units, Timeline 뷰 또는 Lightbox에 로드할 수 있는 이름이 지정된 컬렉션을 정의합니다.
list_name | string | 리스트의 이름 |
options | array | 선택 사항, 옵션 배열 |
array | 옵션 리스트 |
// 'my_list'라는 이름의 옵션 리스트를 가져옵니다.
var list = scheduler.serverList("my_list");
...
// 지정된 옵션으로 리스트를 생성하고 반환합니다.
var list = scheduler.serverList("options", [
{key: 1, label: "John"},
{key: 2, label: "Adam"},
{key: 3, label: "Diane"}
]);
이 메서드를 통해 생성된 리스트는 이후 scheduler.updateCollection 메서드를 사용해 업데이트할 수 있습니다.
셀렉트 옵션이나 Timeline, Units 뷰의 단위 리스트처럼 컬렉션을 업데이트해야 하는 상황에서, 이름이 지정된 옵션 리스트로 정의하는 것이 실용적인 방법입니다.
scheduler.serverList("sections", [
{ key: 1, label: "Section A" },
{ key: 2, label: "Section B" },
{ key: 3, label: "Section C" },
{ key: 4, label: "Section D" }
]);
scheduler.config.lightbox.sections = [
{
name: "description", height: 130, map_to: "text", type: "textarea",
focus: true
},
{
name: "sections", type: "select",
options: scheduler.serverList("sections"), map_to: "section_id" },
{
name: "time", height: 72, type: "time", map_to: "auto"
}
];
...
// 마찬가지로 "units" 리스트 사용
scheduler.createUnitsView({
name: "unit",
property: "section_id",
list: scheduler.serverList("sections") });
scheduler.createTimelineView({
name: "timeline",
x_unit: "minute",
x_date: "%H:%i",
x_step: 30,
x_size: 24,
x_start: 16,
x_length: 48,
y_unit: scheduler.serverList("sections"), y_property: "section_id",
render: "bar"
});
scheduler.init("scheduler_here", new Date(), "unit");
이후, scheduler.updateCollection 메서드를 사용하여 모든 곳에서 옵션을 업데이트할 수 있습니다:
scheduler.updateCollection("sections", [
{ key: 5, label: "Section E" },
{ key: 6, label: "Section F" },
{ key: 7, label: "Section G" }
]);