在Fullcalendar v4中获取外部事件列表中的对象ID

时间:2019-09-24 15:04:44

标签: jquery fullcalendar

fullcalendar v4出现问题。我花了几天的时间来获取在外部列表中声明的对象的ID,如下所示,但没有运气。

chartOptions

在日历中:

$(this).data('event', {
id: 2,
title: $.trim($(this).text()), // use the element's text as the event title
stick: true, // maintain when user navigates (see docs on the renderEvent method)
classNames: [$(this).data('color')],
description: 'Lorem ipsum dolor eius mod tempor labore'
});

然后尝试在drop或eventReceive上检索数据:

var Draggable   = FullCalendarInteraction.Draggable;

        new Draggable(containerEl, {
            itemSelector: '.fc-draggable-handle',
            eventData: function(eventEl) {

                return $(eventEl).data('event');

            }   
        });

1 个答案:

答案 0 :(得分:1)

这是我使用eventReceive找到的解决方案:

eventReceive: function(event) {
// called when a proper external event is dropped
console.log('eventReceive', event);
},