Servoy allows conversion from the data shown in the UI elements to the data used in dataProviders.
By default a dataprovider value is used directly in a UI element.
The UI element must support the data type and knows how to handle it.
A UI converter can be configured to realize the conversion between the dataprovider data and UI data.
For example, a datetime dataprovider can be shown and edited in a calendar UI element.
With a UI converter, one can use any dataprovider type in any UI element.
UI converters are currently not supported by the Solution Model.
In This Chapter
The UI converter is configured at element level in the form editor.
It is edited as part of the format property of an element.
The format property editor allows configuration of the UI converter (mark the checkbox and select one of the available converters).
Servoy delivers one built-in UI converter, the GlobalMethodConverter, which can also be used as database value converter.
The GlobalMethodConverter has 3 properties:
Example of configuring a UI converter for a form element using the GlobalMethodConverter: This example shows the conversion of null values to '-' in the UI.
Defining the converter methods in globals.js:
Configuring the UI converter of field 'fldAge' format property:
Code that tests the dataprovider/UI value:
The image below shows how data is displayed in the UI:
A UI converter can be contributed by a Java plugin.
See Providing UI Converters from Plugins for an example on how to implement a plugin which provides a UI converter.