- 03 Nov 2020
- 1 Minute to read
- Contributors

- Print
- DarkLight
Datepicker Exceptions
- Updated on 03 Nov 2020
- 1 Minute to read
- Contributors

- Print
- DarkLight
Since 2.22.3 (with patch), it’s possible to add calendar exceptions to datepickers in Comflow.
Enable Exceptions
Datepicker exceptions are enabled and disabled with a property in sitedef. Default value is false. This property will control all datepickers.
<Property name="portal.datepicker.calendar.exceptions.show" value="true"/>
<!-- Possible values are true and false. Default value is false.-->
The property value can be retrieved with method net.comactivity.core.site.Site#getPortalDatePickerCalendarExceptionsShow.
Exceptions Service
If datepicker exceptions are enabled, a custom service needs to be defined in sitedef.
<Property name="portal.datepicker.calendar.exceptions.url" value="CustomDatepickerExceptionsService"/>
<!-- Possible values are registered application services. -->
The property value can be retrieved with method net.comactivity.core.site.Site#getPortalDatePickerCalendarExceptionsURL.
Request Format
The request will have four query parameters; sessionId, clientId, fromDate, and toDate.
| Parameter | Description |
|---|---|
| sessionId | Session ID |
| clientId | Synthetic ID of field with datepicker |
| fromDate | Start of date range in ISO 8601 Extended format, YYYY-MM-DDTHH:mm:ss:sssZ |
| toDate | Inclusive end of date range in ISO 8601 Extended format, YYYY-MM-DDTHH:mm:ss:sssZ |
Response Format
The expected response from an exceptions service is a list of object with properties "day", "month", "year", and "description".
Example
[
{
"day": 25,
"month": 12,
"year": 2019,
"description": "Christmas Day"
}
]
Datepicker Field
In order to distinguish between different datepickers, and use different calendar exceptions, field can be resolved from clientId.
String dialogId = RendererModel.getDialogIdFromClientId(clientId);
DialogWorkspace dialogWorkspace = sessionWorkspace.getDialogWorkspace(dialogId);
RendererModel rendererModel = dialogWorkspace.getRendererModel();
Field field = rendererModel.parseClientIdFromViewModel(clientId).getField();
String metadataId = field.getMetadataId();
String tableId = field.getTable();
String columnName = field.getName();
Style Datepicker Exceptions
It is also possible to add custom style to datepicker exceptions. Override or add properties to class CA-dtpCalendarCellHoliday in the Custom.css.
/* Set color 'Dark Sea Green' for all calendar exceptions */
.CA-dtpCalendarCellHoliday {
color: darkseagreen;
}