eventSources (Properties)

달력 UI에 표시할 일정(Event)들의 집합인 이벤트 소스(EventSource)들을 설정합니다.

Type

array

Example

IBCalendar는 달력 UI에 표시할 이벤트 소스(EventSource)의 일정(Event)들의 정보를 아래와 같은 방법으로 설정할 수 있습니다.

  1. JSON Array
options = {
    eventSources: [
    {
        id: "eventSource1",
        events: [
            {
                id: "eventSource1-event1",
                title: "event1",
                start: "2020-06-01",
                end: "2020-06-02",
                allDay: true
            },
            {
                id: "eventSource1-event2",
                title: "event2",
                start: "2020-06-05",
                end: "2020-06-07",
                allDay: true
            },
            .
            .
            .
        ],
    },
    {
        id: "eventSource2",
        events: [
            {
                id: "eventSource2-event3",
                title: "event3",
                start: "2020-06-09T12:30:00",
                end: "2020-06-09T13:30:00",
                allDay: false
            },
            .
            .
            .
        ]
    }
};
  1. Function
options = {
    eventSources: [
    {
        id: "eventSource1",
        events: function(info, success, failure) {
            $.ajax(
                {
                    "url": "https://URL"
                    "method": "GET",
                    "async": false,
                    "dataType": "json",
                    "data": {
                        start: IBCalendar.DateTime.fromJSDate(info.start).toISO(),
                        end: IBCalendar.DateTime.fromJSDate(info.end).toISO()
                    },
                    success: function (data, status, xhr) {
                        success(data);
                    },
                    error: function (xhr, status, errorThrown) {
                        failure(status);
                    }
                }
            );
        }
    }
    ]
};

주의 Ajax 호출시 비동기 문제로 인해 반드시 "async": false 해주어야 합니다.

Since

product version desc
core 1.5.0.0 기능 추가