[FullCalendar Reactive] How to add Background events once the calendar has been loaded (AddEvents- Rendering)
Forge component by André Cabral
Application Type
Reactive

Hi there!
I've been using your component for a couple of weeks and some doubts have arisen, I hope they're easily solveable.

To put us in context, I know how to add Background events before the calendar loads (Rendering = Background or inverse Background). The problem comes when I want to add new ones with an AddEvent once the calendar has already loaded, when I do the events do not appear, however if I remove the rendering option yes.

So that is the question, can it be done? How would it be done?


And in relation to this question, how could I add events to the calendar (When the it's already loaded) without AddEvents, I have tried with NewEventSourceData and the new ones do not appear, also to change the input parameters to see if the calendar refresh and neither.

The only way is to go one by one with AddEvents?


That's it, thanks for your attention!


-- The post is duplicated because I can't edit the previous one, I don't know if someone can delete it. --

Hello Laura,


I've used FullCalendar quite a bit and I also faced the same problem as you did. The only way to update the events dynamically, that I know of was to add them one by one, so I had to use another solution, so to say, using Javascript, which basically consisted of three steps:

  1. "destroy" the calendar (DOM)
  2. Get the new data
  3. "refresh" the calendar (DOM)


Only by rerendering the calendar can it be updated with multiple events. At least, that was the only way I could do it. If anyone else has any other suggestion, would also appreciate it. Anyways here is the small piece of JS code that i use in order to refresh it. 


var forceRedraw = function(element){


 var disp = element.style.display;

  element.style.display = 'none';

  var trick = element.offsetHeight;

  element.style.display = disp;

};


forceRedraw(document.querySelector('[id$="CalendarContainer"]'));



Basically the calendar is in a webblock, and when i need to refresh the data in it, i trigger an event that in turns executes this small piece of JS code. There is more logic associated with it, but that is pertaining the obtaining of the data and adding it to the calendar. Anyways, hope that it helps, if you need anything more, please say.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.