I want to update a cells header either based on an event, so looking for a special string, or through some other way to send in data from an API. This would be something that is unique to each day.
I was able to accomplish this with dayCellDidMount
by looking at arg.view.calendar.getEvents()
The problem is that it seems like dayCellDidMount
runs before the events are pulled, so this method and my custom header only works when I switch months or to other views. But on page load it does not work. Running into a similar issue trying to use dayCellContent
I am using FullCalendar 6.1.10
dayCellDidMount: function(arg) {
console.log("Debug: day cell did mount called");
var weightUtilization = arg.view.calendar.getEvents().find(event =>
event.extendedProps.eventTitle.includes("Weight Utilization") &&
event.start.toDateString() === arg.date.toDateString()
);
if (weightUtilization) {
console.log("Found weightUtilization")
}
},
This is a cut down version of what I have, when I first load the page the first alert will properly trigger but the second will not. In the API every day has this unique event.
When I switch to another month or switch to week view, the second alert will properly trigger since the events are there now. and the part of the code (which is not in this example) that actually updates the header will work and I will see what I am looking for.
So how would I make sure this method would run after events are loaded?
1