Document toolboxDocument toolbox

3.1. Quick start

Minimal configuration

The calendar widget is highly versatile with numerous features, most of which are optional. Setting up a basic configuration requires minimal effort. To get started, simply set all the required widget properties marked with an asterisk (*).

For a basic setup, you only need an event data source with the following attributes: start and end date, event name, an all-day attribute, and event title. This will provide a read-only view of events.

To enable event editing, map the context attributes that will hold the changed values to the event and set the on-change/create microflows. You can fully customize views under the General tab by enabling custom views. Additional features can be enabled under the Features tab.

Calendar context

image-20240722-074512.png

Controlling the view

To control the view from Mendix or to retrieve events visible in the current view based on the start and end dates, you can map these to the context object (StartDate, EndDate, SelectedView). Updating the SelectedView attribute with the ID of the desired view will refresh the widget accordingly. By default the view id’s are day, week, month, year and agenda. Similarly, changing the StartDate attribute will navigate the widget to the specified date.

Persisting changes made in the widget

The calendar context is required for editing events within the widget. This is because the Mendix pluggable widget API currently does not support direct editing of list values. Therefore, changes made by the widget are stored in the context, which can then be used in an on-change or create action to persist these changes to the database. The attributes EventName, EventStart, EventEnd, EventAllDay and EventRecurrance are used for this.

 

Persisting calendar changes

Additionally, if calendars are enabled, you should create an association from your context object to your calendar entity. The widget will set this association for the changed or new event. We supports both single and multiple calendars per event. Ensure that both the association in the events tab and the context mapping have the same type of association (many-to-many or many-to-one).

image-20240711-091818.png

Events

Above you can see the required attributes for setting up an event datasource (marked with *). Note that Event Calendar(s) is only required when calendars are enabled.

Persisting data and event actions

As mentioned earlier, Mendix currently doesn’t support direct editing of list values. Therefore, we need to map the changes to the context and use those context attributes to persist the changes to the event. When any of the event actions is triggered, the widget will update the context attributes with the values of the relevant event. The event can then be updated based on these values.

License

You can try out the Calendar widget locally on your PC or in a Mendix sandbox environment without a license. However, a production application will require a license.

If the app is in production but the Calendar widget is not used on any pages, a license is not required. In this case, you can provide an empty variable or constant.

The license token is entered under the General tab.

 

Â