Datepicker Exceptions
  • 16 Apr 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Datepicker Exceptions

  • Dark
    Light

Article summary

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.

ParameterDescription
sessionIdSession ID
clientIdSynthetic ID of field with datepicker
fromDateStart of date range in ISO 8601 Extended format, YYYY-MM-DDTHH:mm:ss:sssZ
toDateInclusive 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;
}

Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.