全日历事件约束和资源

Fullcalendar event contraints and resources

我正在尝试 this demo in jsbin 使用调度程序处理一些事件并限制将其中一些移动到特定资源。

$('#calendar').fullCalendar({
    schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
    // put your options and callbacks here
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,basicWeek,agendaDay'
    },
    defaultView: 'agendaDay',
    defaultDate: '2017-05-09',
    navLinks: true, // can click day/week names to navigate views
    editable: true,
    nowIndicator: true,
    allDaySlot: false,
    fixedWeekCount: false,
    eventLimit: true, // allow "more" link when too many events
    slotLabelFormat: "HH:mm",
    slotLabelInterval: "00:60:00",
    events: [
        {
            title: 'Long Event',
            start: '2017-05-09T16:00:00',
            end: '2017-05-09T17:00:00',
            resourceId: 'b',
            constraint: {
                resourceIds: ['c', 'd']
            }
        },
        {
            id: 999,
            title: 'Test Event',
            start: '2017-05-09T16:00:00',
            end: '2017-05-09T18:00:00',
            resourceId: 'a',
            constraint: {
                resourceIds: ['b', 'c', 'd']
            }
        }
    ],
    resources: [
        {id: 'a', title: 'Auditorium A'},
        {id: 'b', title: 'Auditorium B'},
        {id: 'c', title: 'Auditorium C'},
        {id: 'd', title: 'Auditorium D'}
    ]
})

现在,如果您按照说明进行操作 here,您会注意到在 resourceIds 中,您指定了您不希望事件发生的 ID。但是在jsbin中你可以看到相反的情况发生了。

此外,如果您打开月视图或周视图,则无法从一天拖放到另一天。由于 eventConstraint 限制您。

我做错了什么或者这是错误的?


暂时解决了这个解决方案的问题,但我认为以上是一个错误。你可以试试my solution here

我所做的是在事件的自定义字段中传递约束并检查放置是否正确。

Now If you follow the instructions here you will notice that inside the resourcesIds you specify the ids that you want the event NOT to go.

不对,文章说的恰恰相反:

Additional properties can be applied to force an event to stay within specific resources

(粗体是我加的。)

这意味着你给出了一个事件可以被拖到的资源列表。因此不能将其拖到任何未在约束 属性.

中命名的资源

根据您发布的 link 中给出的示例:

constraint: {
  resourceIds: [ 'a', 'b', 'c' ] // constrain dragging to these
}

具有此 属性 的事件将只允许被拖到资源 'a'、'b' 和 'c' 上。

我认为您误解了文档。