It’s recommended to read more details about FullCalendar implementations here: https://fullcalendar.io/docs
Table of contents
1. Calendar configurationThis component allows the creation of calendars manually or using existing templates.
In this document it will be explained how to manually create your own calendar, which will be similar to what exists with the creation through a template and next it will also be explained a little about the creation through templates.
1.1 Install the component in your environment
Open the Forge FullCalendar2 and download the component. The demo application can also be downloaded. Install it.
1.2 Create the FullCalendar2 dependency
Open the Manage Dependencies option and search for FullCalendar2. Select the FullCalendar2 dependencies and apply changes.
1.3 Drag the “FullCalendar” widget to your webscreen
Search for FullCalendar2 in the Service Studio toolbox input and drag it to your WebScreen.
1.4 Configure the calendar
It is necessary to configure the Calendar as shown in the image and in the details below.
Input details
2. Manage events
2.1 Load events
Where to implement ?: Preparation
To load events from the database first make an aggregate and get as much events as needed from the entity, then map your entity's fields to "Event" with the "NewEventSourceData" action and then assign the result from the NewEventSourceDate to a local variable of the same data type.
2.2 Date Click events
Which event is triggered?: DateClick
To create an event just click on a day on the calendar and the DateClick event will be triggered.
In the Handler of this event, create a variable with the same type as your entity and assign its fields.
After that, just use the entity's create action to save the event to the database.
Note: If the AdvancedConfig selectable is set True and you are using the Select event, you should not use the DateClick event. And in this case, you also need to disable the Callbacks DateClick Notify.
This is because the select event is also triggered when we click on a date or time. This is the standard behavior of the FullCalendar v4.
2.3 Select events
Which event is triggered?: Select
To create an event just click on a day on the calendar and the SelectEvent event will be triggered. If you want to create an event with multiple days, you can drag the mouse cursor while clicking.
Note that in this DEMO we are using the Title and Description Inputs that are being stored in the EventTitle and EventDescription variables, to be used in the creation of the events.
2.4 Drop and resize events
Which events are triggered?: EventDrop & EventResize
EventDrop is triggered when dragging stops and the event has moved to a different day/time.
EventResize is triggered when resizing stops and the event has changed in duration.
When the user triggers an event, the triggered event sends an "Event" parameter to the handler, containing information about the event to be changed.
To edit an event, just ensure that we edit the existing event in the database and edit it according to the changes made to the calendar.
2.5 Delete events
Which event is triggered?: EventClick
To delete an event, we need to obtain the event ID that we want to delete. In the example below, we are using the “EventClick” event, which is triggered when the user clicks on an event in the calendar. When the user clicks on an event, the event fires and sends an "Event" parameter to the handler, containing information about the clicked event, such as its ID.
Then we delete the event using such ID on the entity's delete action.
2.6 Draggable events
Which event is triggered?: EventReceive
It is possible to create events by simply dragging and dropping them.
To create a draggable event we need to create a list of the events we want to create first.
Then we need to list these events in a ListRecords.
REQUIREMENT:
For draggable to work it is necessary to place the external-events class in the ListRecords Style Classes.
2.7 View Change events Which events are triggered?: ViewChange
This event returns the current active View and the current active Initial Date in the Calendar. And can therefore be used to update the DefaultView (AdvancedConfig) and DefaultDate (input parameter) of the Calendar before ajax refreshing the calendar.
This event is triggered in 2 different circumstances:
1 - When the view changes (applies to Month, TimeGrid, List and DayGrid views), for example, when the view changes from Month to Week;
2 - When the user clicks on one of the following buttons of the Calendar: prev, next, prevYear, nextYear, today.
An alternative for this behavior is to use the datesRender callback, which can be defined in the input parameter AdvancedConfig. More information here.
2.8 Advanced configuration
With the advanced configuration, you can tweak various settings of the calendar to make it fit your needs.
To update the settings just edit in the DEMO Screen input and save it in the database to be loaded by the calendar.
3. Using Templates
You can create Calendars using existing templates. For that, you just need to create a new WebScreen and select the most appropriate template.
3.1 Calendar
This template contains a calendar similar to the one explained above. It allows the creation, dropping and resizing of events from a table. It also allows you to create predefined Draggable events.
Calendar (from event feed)
This template allows the creation, dropping and resizing of events from source url or Web Services. It also allows you to create predefined Draggable events.
It uses WebService methods to insert and update events.
RunCalendarRefetchEvents: This server action runs JavaScript code to refresh the calendar events.
Calendar Background
Calendar to display events as background events.
It's not different from the Calendar template. It's just that in this template, we turned all the events into background events to show you how they work.
Calendar resources
Calendar to schedule events by resource. It should be used cases where you need to allocate specific time slots for different types of "things" (assigning people to meeting rooms, assigning work to people in a pool of resources).