Property Types

This version of the Property Types page is meant for custom components / services creators. For a basic version that only details how these types can be used inside Servoy solutions, see this page instead.

Not all property types are really meant for usage as API method parameters. Some of them are really meant for model property types only. Examples: dataprovider, tagstring (normal string will translate i18n, tags can't be resolved through api), media and valuelist (create a dataset out of a valuelist and with application.getValueListItems("vlname")), ...

Provided property value types

boolean

Boolean value, either true or false

border

CSS border string representation

clientfunction

This property type must be used in Titanium if the value of the property represents a javacript function that has to run client side. In NG1 (tag)string property type was used for this purpose, but for Titanium NG Client we must know when it is meant to be a client side javascript function rather then a simple string (due to Content Security Policy - security reasons). It is still a string at design time in both cases.

For NG1 it works the same as a tagstring property type and you can run the code inside the browser. But for Titanium this is handled differently: the component gets a function that is retrieved in a way that the browser allows - directly from the model (instead of getting a string and do an eval(string) on it to generate the function). This difference is because in Titanium it is not allowed to do eval in the browser by default - Content Security Policy doesn't allow that for security reasons.

Starting with version 2023.09, it is supported to use clientfunction(s) in the designer (input is still a simple string input) not just in properties typed that way in the component but also inside pure map or json property type values - but then - for a known possible sub-property/key that has 'clientfunction' type, this must be set in the .spec file of the component / service as a "value_types" tag on the map/json property type declaration; see map for an example.

If, for a 'map' or 'json' typed value, the sub-property/key that is supposed to be a 'clientfunction' is not set in the .spec file correctly (that it should be seen as a 'clientfunction') - or if you need to use it in a plain 'object' type - then this can be done correctly in Titanium through code, by creating a client side BrowserFunction explicitly - see clientutils.generateBrowserFunction(...)

color

String color value

Example:

#FFFFFF

dataprovider

Reference to a dataprovider, either a record or scope/form variable.

Can become a complex definition if it needs to support onDataChange, it needs to be able to send changes to server or display tags.

The ondatachange handler will receive as parameter the old datarovider value, the new dataprovider value and a JSEvent.

Starting with 2021.06 release the JSEvent.data will contain an object: {dataprovider : dataProviderID, scope : dataproviderScope, scopeid : variable_scope_or_datasource}.

Definition:

{ 
    "type": "dataprovider",
    "pushToServer": "allow", // optional: needed if you want this component
        // to be able to change the dataprovider's value on the server
    "ondatachange": { // optional
        "onchange": "onDataChangeMethodID", // the name of a handler
            // defined in spec
        "callback": "onDataChangeCallback" // the name of an API func
            // defined by the webcomponent that will get called when
            // pushed data change is successfully applied on server
    },
    "forFoundset" : "myFoundsetPropertyName", // optional; if specified
        // then on the client instead of one value you will get an
        // array of values one for each record in the viewport of given
        // foundset property (see also 'foundset' property type)
    "displayTagsPropertyName" : "myDisplaysTagsProp", // default is null.
        // If specified then the property will initially read the
        // boolean value of the property with given name; If that
        // property is true, tags (%%x%%) will be replaced, otherwise
        // they will be ignored (in which case it will just replace i18n
        // and html); if null, tags will be replaced or not based on
        // config option "displayTags"
    "displayTags" : false, // default is false. If displayTagsPropertyName
        // is non-null it will be ignored. Otherwise, only if it's value
        // is true, this property will parse tags (%%x%%)
    "resolveValuelist" : false // optional, default value is false
        // this is an optimization for read-only dataproviders
        // if true, the dataprovider will send directly the display value
        // from linked valuelist instead of real value; valuelist will
        // have no values sent to client; this way client doesn't need
        // to resolve the valuelist value anymore
}

Starting with 8.4, if 'forFoundset' above is used, then the client-side (in browser) value also provides two methods: addChangeListener / removeChangeListener. So you can add a listener that will receive updates (row insert/delete/change or full viewport update) similar to how the change listener in foundset property type works. Remember to always remove any added change listeners when the component's $scope is destroyed - similar to what is described in the link for the foundset property type listener.

In order for dataprovider typed properties to 'push' their value changes to the server (so changes in the browser to end up in records or scope/form variables) you must either use autoApply or directly apply / startEdit. If you do not 'apply' (auto or manually) the change, the updates will not be sent to server.

Simple example of read-only dataprovider: .spec

{
    "name": "my-component",
    "displayName": ...,
    (...)
    "model":
    {
            "myDataProvider" : "dataprovider",
            (...)
    },
    (...)
}

.html

<input (...) ng-model="model.myDataProvider" svy-autoapply />

In server-side (solution) scripting, accessing a dataprovider property - for example "elements.myField.myDataprovider" - will yield a string: the dataprovider id (name of variable/column). You can also assign a dataprovider id (string) to that property.

Client side, the value of a dataprovider property depends on the actual value of the dataprovider (column/variable/...) as well as the type of the dataprovider (is it a number in the database, or a blob / string / date etc.).

For primitives dataprovider types, it will be the primitive value. For date dataprovider types, it will be a Date object on client.

For MEDIA typed dataproviders the client-side value depends on the server side value's content:

  • if the value is a BLOB / byte array then client-side you will get an object with two keys: { url: ... , contentType: ... } that can be used to load that content in the browser

  • if the value is a date, you will get a Date on client

  • if the value is a string:

    • if it starts with "media:///" it will be an URL string on the client that points to that server side media resource from the solution

    • other strings will be treated as strings

  • primitive types will just be sent 'as-is' to client

dataset

JSDataSet type equivalent. Currently can be used only for runtime api or model (to send a dataset to client).

Example

"jsDataSet":{"type" :"dataset", "includeColumnNames": true,
                                 "columnTypes":{ "icon" : "media" }}

The type can have two configuration properties:

  1. includeColumnNames , default false, will also send the column names as a separate array to client as the first row

  2. columnTypes can specify some column types which will be used for converting the value to send client side, this is needed for non basic columns/types

date

Date value

dimension

Dimension representation

Example

{
    width: 100, 
    height: 20
}

double

A floating point number

findmode

This property is for handling the find mode for a component (if the component needs to react spefic to findmode, like no formatting, allowing any kind of input) See