使用angular从FULLCALENDAR中的事件获取数据
例如,我正在使用fullcalendar,我不确定在与它进行交互时如何获得每个事件的完整数据。我正在使用下一个日历选项:使用angular从FULLCALENDAR中的事件获取数据,angular,fullcalendar,Angular,Fullcalendar,例如,我正在使用fullcalendar,我不确定在与它进行交互时如何获得每个事件的完整数据。我正在使用下一个日历选项: calendarOptions: CalendarOptions = { initialView: 'dayGridMonth', //plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin, listPlugin], headerToolbar: { left: '',
calendarOptions: CalendarOptions = {
initialView: 'dayGridMonth',
//plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin, listPlugin],
headerToolbar: {
left: '',
center: 'title',
// right: 'prev,next,today,dayGridMonth,resourceTimeline,listMonth'
right: 'prev,next,dayGridMonth'
},
dateClick: this.createTaskModal.bind(this),
titleFormat: { month: 'long' } ,
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
locale: esLocale,
navLinks: true, // can click day/week names to navigate views
selectable: true,
dayHeaders: true,
selectMirror: true,
editable: true,
eventClick: this.updateModal.bind(this), //this.seeTask.bind(this),
eventDrop: this.updateDates.bind(this),
// weekends: false,
events: this.events,
}
因此,我的问题是,我从eventClick或eventDrop中获取的数据看起来只是日历用于在日历上绘制所有任务的数据,但我需要获取事件的完整元素,例如,如果我的事件具有日历中的下一个结构:
title: "someTitle"
TaskId: "personalizedId"
end: "2020-21-04"
start: "2020-21-04"
Description: "MyOwnDescription"
我需要将这些值输入到每个事件中,因此我正在尝试以正确的方式进行操作?如何在下拉菜单中获取所有信息,甚至单击以将其用于我的函数?在fullCalendar中,您的自定义事件数据位于“extendedProps”属性中
在fullCalendar中,自定义事件数据位于“extendedProps”属性中
如果从eventClick获取的信息中缺少taskID和Description,那是因为它们是非标准属性,因此位于事件的“extendedProps”属性中。这是有文件记录的-请参阅。因此,如果您有一个名为
event
的事件对象,那么event.extendedProps.Description
将返回描述。这对你有帮助吗?实际上,问题中有一点不清楚到底是什么问题。@ADyson这正是我要找的,非常感谢您从eventClick获得的信息中缺少taskID和描述,这是因为它们是非标准属性,因此是事件“extendedProps”属性中的位置。这是有文件记录的-请参阅。因此,如果您有一个名为event
的事件对象,那么event.extendedProps.Description
将返回描述。这对你有帮助吗?事实上,这个问题有点不清楚到底是什么问题。@ADyson这正是我想要的,谢谢你,所以muchIt与Angular无关,它是fullCalendar内部工作的方式。我对您的答案进行了编辑,以使其更准确。@ADyson我检查了这一点,您是正确的,过去我在jquery中使用旧版本,最近我在angular上使用新版本,它在版本上发生了更改,而不是在框架上。这与angular无关,这是fullCalendar内部的工作方式。我对您的答案进行了编辑以使其更准确。@ADyson我检查了这一点,您是正确的,过去我在jquery中使用了旧版本,最近我在angular上使用了新版本,它在版本上发生了更改,而不是在框架上。
updateDates(info) {
let yourData = info.event.extendedProps;
// rest of your code
}