Hellow world. I am using Fullcalendar v5. Having problem setting Props dynamicaly on multipule props.
Attached is a code that show the problem.
You can see it in action here: https://codepen.io/roi-werner/pen/vYKXOJp
When a setProp is called more than once, events in the past week are only effected by the last call, and ignores whatever comes before. In this code it suppose to change the name and the background, it doest so only to the event in the view that is initially loaded and not on the others.
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<link href='../gse5/fullcalendar-scheduler-5/lib/main.css' rel='stylesheet' />
<script src='../gse5/fullcalendar-scheduler-5/lib/main.js'></script>
<script src='../gse5/fullcalendar-scheduler-5/lib/main.min.js'></script>
</head>
<body>
<div id='calendar'></div>
<script>
var calendarEl = document.getElementById('calendar');
let today = new Date().toISOString().slice(0, 10)
var calendarEl = document.getElementById('calendar');
myCalendar = new FullCalendar.Calendar(calendarEl, {
now: today,
aspectRatio: 1.8,
initialView: 'timeGridWeek',
selectMinDistance: 15,
events: [
{
//please change date to be in the past - needs to be in the week before!
title: 'TEST1',
start: '2020-10-16T10:30:00',
end: '2020-10-16T13:30:00',
},
{
//please change the date to be in the future
title: 'Test2',
start: '2020-10-18T10:30:00',
end: '2020-10-18T13:30:00',
},
],
eventDidMount: function(arg){
console.log("call eventMount from calendar");
eventMount(arg);
},
});
myCalendar.render();
function eventMount(arg){
console.log(arg.event.title);
arg.event.setProp('title',"name changed");
arg.event.setProp('backgroundColor','#666666');
}
</script>
</body>
</html>