Page History
...
The function description in the handlers section can be just "function" or a more complex type describing the arguments and return type
Code Block |
---|
"functionName" : { "returns": : "string", "parameters" : [ { "name" : "start", "type" : "int" }, { "name" : "end", "type" : "int" } ] } |
The signature description json for functions in the api section describes the arguments, type of call and return type:
Code Block |
---|
"functionName" : { "returns" : "string", "parameters" : [ { "name" : "startIndex", "type" : "int" }, { "name" : "endIndex", "type" : "int" }, { "name" : "theData", "type" : { "type" : "dataset", "includeColumnNames" : true, "columnTypes" : { "icon" : "media" } } } ], "blockEventProcessing": true, "async": true } |
...
pushToServer value | description |
---|---|
reject | this is the default, no data synchronization from client to server for this property |
allow | data changes from client to server are allowed |
shallow | same as allow, but sablo will also add a watch on the model (in the client) and send changes to the server; the watch is based on object reference/primitive value (more performant, but in case of structured/nested objects it will only trigger data synchronization when the objects are different by reference, even if they are actually 'equal' by content) |
deep | same as allow, but sablo will also add a watch on the model (in the client) and send changes to the server; the watch is based on object equality (compares old and new values of structured/nested objects, less performant because it keeps and compares to two copies of structured/nested objects) |
...
Code Block | ||||
---|---|---|---|---|
| ||||
"model": { "searchfield" : { "type": "string", "pushToServer": "shallow" } } } |
Note that in Servoy, data-provider properties are synchronized property changes are sent to server using svy-apply (servoy api call) and svy-autoapply , for (directive); for these to work properly, these properties pushToServer should be set pushToServer to allow. Otherwise those data provider properties will be read-only.
Tags
Properties can be configured with special tags that may be interpreted by the deployment environment.
...
Code Block | ||
---|---|---|
| ||
"text": { "type": "string", "default": "I am a button" } |
But this would mean that restore to default or empty the property would always set that default property back. This is wanted behavior if the property has to have some default value like if a property must be 1 of a few values and the default is one of those.
...
Code Block | ||
---|---|---|
| ||
"text" : { "type": "tagstring" , "initialValue": "Button text", "tags": { "directEdit" : "true" } }, |
This is like a constructor value, set only once when the component is created.
...
Code Block | ||||
---|---|---|---|---|
| ||||
"model": { "enabled" : { "type": "enabled", "blockingOn": false, "default": true } } |
It is important to use type enabled
if we want the value from the parent container (i.e. form, portal) to be pushed to the component. For instance if a portal is disabled, then all the components from the portal which have a property of type enabled
will also be disabled.
...
Code Block | ||||
---|---|---|---|---|
| ||||
"model" : { "readOnly": { "type": "protected", "blockingOn" : true, "default": false, "tags": {"scope": "runtime"} }, "editable": { "type": "protected", "blockingOn": false, "default": true } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
"model" : {
"myfindmodeproperty": "findmode"
} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
{ "name": "servoydefault-tabpanel", "displayName": "Tab Panel", "version": 1, "icon": "servoydefault/tabpanel/tabs.gif", "definition": "servoydefault/tabpanel/tabpanel.js", "serverscript": "servoydefault/tabpanel/tabpanel_server.js", "libraries": [{ "name": "accordionpanel", "version": "1", "url": "servoydefault/tabpanel/accordionpanel.css", "mimetype": "text/css" }], "model": { "background" : "color", "borderType" : { "type": "border", "stringformat": true }, "enabled" : { "type": "enabled", "blockingOn": false, "default": true }, "fontType" : { "type": "font", "stringformat": true }, "foreground" : "color", "horizontalAlignment" : { "type": :"int", "tags": { "scope": :"design" }, "values": :[{ "LEFT": 2 }, { "CENTER": 0 }, { "RIGHT": 4 }], "default" : -1 }, "location" : "point", "readOnly" : "protected", "selectedTabColor" : "color", "size" : { "type": :"dimension", "default" : { "width": 300, "height": 300 } }, "styleClass" : { "type": :"styleclass", "tags": { "scope": :"design" }, "values": :[] }, ""tabIndex" : { "type": "object", "pushToserver": "shallow" }, "tabOrientation" : { "type": :"int", "tags": { "scope": :"design" }, "values": :[{ "default": :0 }, { "TOP": 1 }, { "HIDE": -1 }] }, "tabSeq" : { "type": :"tabseq", "tags": { "scope": :"design" } }, "tabs" : { "type": "tab[]", "droppable": true }, "transparent" : "boolean", "visible" : "visible" }, "handlers": { "onChangeMethodID" : "function", "onTabChangeMethodID" : "function" }, "api": { "addTab": { "returns": "boolean", "parameters": [{ "name": "form/formname", { "type": "object []" }, { "name": "name", "type": "object", "optional": true }, { "name": "form/formnametabText", "type": "object", "typeoptional":"object []"true }, { }"name": "tooltip", "type": "object", { "optional": true }, { "name": "iconURL", "type": "object", "optional": true }, { "name": "namefg", "type": "object", "typeoptional":"object", true }, { "name": "optional":truebg", "type": "object", }, "optional": true }, { "name": {"relatedfoundset/relationname", "type": "object", "optional": true }, { "name": "index", "type": "object", "nameoptional":"tabText", true }] }, "typegetMaxTabIndex":"object", { "returns": "int" }, "optionalgetMnemonicAt":true { "returns": "string", "parameters": [{ }, "name": "i", "type": "int" { }] }, "getSelectedTabFormName": { "returns": "string" }, "getTabBGColorAt": { "returns": "string", "parameters": [{ "name":"tooltip", "name": "unnamed_0", "type": "objectint", }] }, "optionalgetTabFGColorAt":true { "returns": "string", "parameters": [{ }, "name": "i", "type": "int" { }] }, "getTabFormNameAt": { "returns": "string", "parameters": [{ "name": "i", "name"type": "iconURLint", }] }, "type":"object", "optional":true }, { "name":"fg", "type":"object", "optional":true }, { "name":"bg", "type":"object", "optional":true }, { "name":"relatedfoundset/relationname", "type":"object", "optional":true }, { "name":"index", "type":"object", "optional":true } ] }, "getMaxTabIndex": { "returns": "int" }, "getMnemonicAt": { "returns": "string", "parameters":[ { "name":"i", "type":"int" } ] }, "getSelectedTabFormName": { "returns": "string" }, "getTabBGColorAt": { "returns": "string", "parameters":[ { "name":"unnamed_0", "type":"int" } ] }, "getTabFGColorAt": { "returns": "string", "parameters":[ { "name":"i", "type":"int" } ] }, "getTabFormNameAt": { "returns": "string", "parameters":[ { "name":"i", "type":"int" } ] }, "getTabNameAt": { "returns": "string", "parameters":[ { "name":"i", "type":"int" } ] }, "getTabRelationNameAt": { "returns": "string", "parameters":[ { "name":"i", "type":"int" } ] }, "getTabTextAt": { "returns": "string", "parameters":[ { "name":"i", "type":"int" } ] }, "isTabEnabled": { "returns": "boolean", "parameters":[ { "name":"unnamed_0", "type":"int" } ] }, "isTabEnabledAt": { "returns": "boolean", "parameters":[ { "name":"i", "type":"int" } ] }, "removeAllTabs": { "returns": "boolean" }, "removeTabAt": { "returns": "boolean", "parameters":[ { "name":"index", "type":"int" } ] }, "setMnemonicAt": { "parameters":[ { "name":"index", "type":"int" }, { "name":"text", "type":"string" } ] }, "setTabBGColorAt": { "parameters":[ { "name":"unnamed_0", "type":"int" }, { "name":"unnamed_1", "type":"string" } ] }, "setTabEnabled": { "parameters":[ { "name":"unnamed_0", "type":"int" }, { "name":"unnamed_1", "type":"boolean" } "getTabNameAt": { ] }"returns": "string", "setTabEnabledAtparameters": [{ "parametersname":[ "i", "type": "int" }] { }, "getTabRelationNameAt": { "returns": "string", "parameters": [{ "name": "i", "nametype": "iint", }] }, "typegetTabTextAt":"int" { "returns": "string", }, "parameters": [{ "name": "i", { "type": "int" }] }, "isTabEnabled": { "returns": "boolean", "parameters": [{ "name": "unnamed_0", "nametype": "bint", }] }, "typeisTabEnabledAt":"boolean" { "returns": "boolean", "parameters": [{ } "name": "i", "type": "int" ] }] }, "setTabFGColorAtremoveAllTabs": { "parametersreturns":[ "boolean" }, "removeTabAt": { { "returns": "boolean", "parameters": [{ "name": "index", "type": "int" }] }, "setMnemonicAt": { "parameters": [{ "name":"i", "name": "index", "type": "int" }, { }, "name": "text", "type": "string" }] { }, "setTabBGColorAt": { "parameters": [{ "name": "unnamed_0", "type": "int" }, { "name": "sunnamed_1", "type": "string" }] }, "setTabEnabled": { } "parameters": [{ "name": "unnamed_0", ] },"type": "int" "setTabTextAt":}, { "parametersname":[ "unnamed_1", "type": "boolean" }] { }, "setTabEnabledAt": { "parameters": [{ "name": "i", "type": "int" }, { "name": "indexb", "type": "intboolean" }] }, "setTabFGColorAt": { }, "parameters": [{ "name": "i", { "type": "int" }, { "name": "s", "type": "string" }] }, "namesetTabTextAt":"text", { "parameters": [{ "typename": "stringindex", "type": "int" }, { } "name": "text", "type": "string" ] }] } }, "types": { "tab": { "name": "string", "containsFormId": "form", "text": "tagstring", "relationName": "relation", "active": "boolean", "foreground": "color", "disabled": "boolean", "imageMediaID": "media", "mnemonic": "string" } } } } |
Serverside scripting
Anchor | ||||
---|---|---|---|---|
|
...