Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 获取Fullcalendar v4中外部事件列表中对象的ID_Jquery_Fullcalendar - Fatal编程技术网

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

Jquery 获取Fullcalendar v4中外部事件列表中对象的ID,jquery,fullcalendar,Jquery,Fullcalendar,我对fullcalendar v4有问题。我花了好几天的时间试图获取一个在外部列表中声明的对象的id,如下所示,但没有成功 $(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)

我对fullcalendar v4有问题。我花了好几天的时间试图获取一个在外部列表中声明的对象的id,如下所示,但没有成功

$(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'
});
在日历中:

var Draggable   = FullCalendarInteraction.Draggable;

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

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

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

eventReceive: function(event, view) {
                alert("Dropped event: " + event);  // any data linked to the dropped event 

                var datax = $(this).data('event');

                console.log(datax);

            },    

            drop: function(arg) {

                console.log(arg.draggedEl);

                // is the "remove after drop" checkbox checked?
                if ($('#kt_calendar_external_events_remove').is(':checked')) {
                    // if so, remove the element from the "Draggable Events" list
                    $(arg.draggedEl).remove();
                }
            }, 

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

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

任何人我正在使用这个示例:如何获取对象数据?id、title等为任何有相同问题的人找到解决方案。eventReceive:function(event){//在删除正确的外部事件时调用console.log('eventReceive',event);},如果找到了解决方案,请将其添加为下面的答案。如果人们喜欢的话,他们可以投票……:-)是的,但那是一个评论。我建议你把它作为一个正确的答案添加进去,然后人们就可以投票了(它会在谷歌的搜索结果中显示出来)