如何解决FullCalendar无法更新点击事件
我正在使用fullCalendar 5.0,并且尝试更新事件的描述,当前,当鼠标悬停在事件上方时,弹出窗口会显示该事件的描述。但是,当我更新事件时,即使对象不再相同,弹出窗口显示时的描述也保持不变。
这是我的代码:
let finalEvents: Array<trueEvents> = await formatEvents(my_events); // format the events to their final form
console.log('final events are : ',finalEvents);
let calendarEl: HTMLElement = document.getElementById('calendar')!;
let calendar = new Calendar(calendarEl,{ // create the calendar
plugins: [ interactionPlugin,dayGridPlugin,timeGridPlugin,listPlugin,resourceTimeGridPlugin ],// setting all the plugin we will use
headerToolbar: {
left: 'prev,next today',center: 'title',right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek,timeGridFourDay'
},events: finalEvents,// set the events
editable: true,// set the edition to true (so you can move the events in the calendar)
eventDidMount: async function (info: MountArg<EventContentArg>) { //shows the description of the event when your mouse is over it
let tooltip = new Tooltip(info.el,{
title: info.event.extendedProps.details,placement: 'top',trigger: 'hover',closeOnClickOutside: true,container: 'body'
});
},eventClick: async function (info: EventClickArg) { // change the description of the event when the event is clicked
console.log('event clicked');
let description = prompt('Please enter a new description');
let _description = (description != null) ? description : 'sample description';
console.log(_description);
let date = await getCurrentDate(finalEvents,info.event.title);
console.log(date);
console.log('before : ',finalEvents);
finalEvents = await updateDescription(finalEvents,info.event.title,date,_description); // here I find the corresponding event in my object and modify its description;
}
calendar.render();
});
提前谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。