-
Hello, firstly, I would like to thank you for the great calendar. I wanted to ask if someone could send me an example code for adding and deleting an event, ideally with preparation for database. I came across a paragraph in the readme and also saw few examples here from discussion, but unfortunately, I still don't understand how to use the functionality. Thanks in advance for any advice. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hello, I would suggest loading data from the server using the eventSources option. In this option you can either specify a URL for loading events, or specify your own function that will provide the data. I would like to point out that in this way the data is not loaded in its entirety, but only those events that should be displayed in the current view, i.e. the calendar provides parameters for the start and end of the displayed period. Then when you need to add or delete an event, you send a request to the server with the necessary parameters. And the next step is to call refetchEvents. This way the server will perform the necessary actions in the database, and after that the updated list of events will be re-loaded into the calendar. |
Beta Was this translation helpful? Give feedback.
-
Hi! I am having the same problem as described above. I have figured out how to use the select callback but am then unsure of how to actually create an event within this callback. Does anyone have an example of how to do this? |
Beta Was this translation helpful? Give feedback.
Once you have selected free time in the calendar, the select callback is called, inside which you can create an event and add it to the calendar (as described above). Displaying a popup, interacting with your server to create an event or delete an event are all outside the scope of the Event Calendar library.
As for displaying a cross inside an event, you can control the content that is displayed inside each event using the eventContent option.