3.2.1. Events
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.
Make sure to refresh the event datasource when creating new events. As the sever object is needed to properly render the content and process further changes.
Event content
Under the Events tab, you can specify the event content in the Event Title property. This is a translatable text. There are 3 ways to render the content for the events:
Plain Text: Any HTML or special characters will be ignored and displayed as tags.
HTML (Sanitized): Filters potentially dangerous HTML but renders simple HTML tags like
<b></b>
.HTML (Un-sanitized): Renders any HTML, including script tags, which can lead to XSS attacks. This option should not be used if potentially malicious content can be included in an event title.
Overriding content on a per view basis
Note that the event content can be overwritten on a per-view basis and based on whether it's an all-day event or a regular event if you are using custom views. To learn more about this, see: https://bizzomate.atlassian.net/wiki/x/AQDfng
Recurrance rules
You can specify recurrence rules for your events. For instance, you can make an event repeat every day of the week, only on Sunday, etc. See https://bizzomate.atlassian.net/wiki/x/GAC0nw for details.
Â
Note that the event menu will perform actions based on the base event or first occurrence when right-clicking occurrences for custom actions (because custom actions need to be tied to a database object). This differs from the default edit and delete menu items, which are tied to the specific occurrence.
Styling
There are various ways to style an event: by using a dynamic class or by using the default colors included in the widget.
For an example see: Event styling demo
Using the default styling options
Colors
The default event color can be chosen and then overridden by the event color, if desired. The event color can also be left blank. If left blank, the default event color will be applied. To apply a event color, you can use a string or the provided enumeration ENUM_Color
found in the resources folder of the scheduler module. Like so:
getKey(BizzomateCalendar.ENUM_Color.cyan)
Or when you have an attribute on your object that uses the color enum:
getKey($currentObject/EventColor)
Using a dynamic class to style your events
You can define a class to style your events in any way you want. If you don't assign a custom class or if the expression returns empty, the default class will be added to the event wrapper: event-type--default
. When an event is creating (when drag creating for instance) class event-type--creating-new
is added.
.event-type--my-custom-event.b-cal-event-wrap {
// wrapper styles (only style when really needed)
> .b-cal-event {
// contains background color, etc.
> .b-cal-event-body {
// wrapper for your event content
}
}
}
Event icon class
The icons use the font awesome 4 library that comes bundled with the scheduler. However, it's important to read up on how to use it properly in: https://bizzomate.atlassian.net/wiki/x/eACbnw
Â
Event permissions
Under the Event Permissions section, you can override what a user can or cannot do with events. This can be done globally by setting the editable property to false, or on a per-event basis using expressions like $currentObject/Editable
. If not overridden, a user will be able to perform any action that is properly configured in the widget (e.g., you need to specify a delete microflow before deleting is possible).
Event tooltips
There are three settings for event tooltips:
Default Tooltip: Displays the time in a tooltip.
Custom Tooltip: Once enabled, it will be a placeholder for Mendix content on the page.
No Tooltip: Disables the tooltip entirely.