Data Types
Data widgets can declare one of the listed data types, each with additional optional constraints.
Constraints on the data type goes beyond the UI. These constraints will be enforced when data is submitted to the server.
string
- A piece of text.
- Constraints:
length
: the max number of characters allowed, including multi-byte charaters. Note, if this length is greater than255
the submitted value will be stored asCLOB
in the database and will not be sortable. Default value:50
subType
- URL
format
: limit user's input to specific format, use # for numbers 0-9, @ for letters A-Z and ? for number or lettersimplePattern
invalidMessage
multiValue
-true
orfalse
. Iftrue
, the value returned by the widget is an array of strings, otherwise it is a single string. The default value isfalse
.
const myWidgetDefinition = {
...
datatype: {
type: 'string',
length: 50,
format: {
simplePattern: '#####,#####-####' // US zip code
invalidMessage: 'Please enter a valid US zip code'
}
}
...
};
'boolean'
- A
true
orfalse
value. Anull
value is not supported. The default value isfalse
- Constraints:
- None.
'number'
- A number.
- Contraints:
numberType
: one of'decimal'
or'integer'
. Default:'decimal'
decimalPlaces
: if number is a'decimal'
, will round to the given number of decimal places. Default:2
minValue
: minimum value of number expected. Can be omitted or set tonull
if no minimummaxValue
: maximum value of number expected. Can be omitted or set tonull
if no maximum
const myWidgetDefinition = {
...
datatype: {
type: 'number',
numberType: 'decimal',
decimalPlaces: 2
}
...
};
'date'
- A date-only value in
'YYYY-MM-DD'
string format. - Custom widgets are expected to handle the setting of the date in a
'YYYY-MM-DD'
string format, or as aDate
object. - Contraints:
minValue
: minimum value of date expected. Can be omitted or set tonull
if no minimummaxValue
: maximum value of date expected. Can be omitted or set tonull
if no maximum
'time'
- A time-only value in
'hh:mm'
string format (24-hour clock). - Contraints:
minValue
: minimum value of time expected. Can be omitted or set tonull
if no minimummaxValue
: maximum value of time expected. Can be omitted or set tonull
if no maximum
'timestamp'
- A date-time value in ISO 8601
'YYYY-MM-DDThh:mmZ'
string format, normalized to the UTC timezone (denoted byZ
) - Custom widgets are expected to handle the setting of the date ISO 8601
'YYYY-MM-DDThh:mmZ'
format, or as aDate
object. - Constraints:
minValue
: minimum value of time stamp expected. Can be omitted or set tonull
if no minimummaxValue
: maximum value of time stamp expected. Can be omitted or set tonull
if no maximum
Parent topic: Custom Widget API