如何使用 scheduler.js 在全日历中添加事件?

How to add events in fullcalendar with scheduler.js?

我不知道如何在全日历中添加事件scheduler.js,谁能帮我吗?

我可以使用完整日历添加事件,但没有 scheduler.js 行得通。

当我将此代码添加到我的脚本时,事件不会添加

select: function(start, end) 
{
    this.title = prompt('Event Title:');
    this.eventData;
    if (this.title) {
        this.eventData = {
            title: this.title,
            start: start,
            end: end
        };
        $('#calendar').fullCalendar('renderEvent', this.eventData, true); // stick? = true
    }
    $('#calendar').fullCalendar('unselect');
},

您还需要加载资源并在您的活动中指定您的资源 ID。所以如果你把它们放上去,它就会成功。试试这个代码。

 select: function(start, end) 
    {
        this.title = prompt('Event Title:');
        this.eventData;
        if (this.title) {
            this.eventData = {
                title: this.title,
                start: start,
                end: end,
                resourceId:['ResourceID1'] // Example  of resource ID
            };
            $('#calendar').fullCalendar('getResources')// This loads the resources your events are associated with(you have toload your resources as well )
            $('#calendar').fullCalendar('renderEvent', this.eventData, true); // stick? = true
        }
        $('#calendar').fullCalendar('unselect');
    },

资源示例如下:

$('#calendar').fullCalendar({
header: {left: 'prev,next today', center: 'title', right: ''},
                    selectable: true,
allDayDefault: false,
unselectAuto: false,
editable: false,
slotLabelFormat:"HH:mm",
resources: [[id:'ResourceID1', title:"Just a title"],[id:'ResourceID2', title:"Just a title part II"]]
})