Child pages
  • Specification (.spec file)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
	(...)
	"model": {
		"columns": {
			"type": "column[]",
			"tags": { "doc": "Define the table's columns using this property." },
			"elementConfig": {
				"tags": { "doc": "A column definition describes all that is needed to show that column properly in the table." }
			},
			(...)
		},
		(...)
	},
	"types": {
		"column": {
			"dataprovider": { "type": "dataprovider", "forFoundset": "foundset", (...), "tags": { "doc" : "Choose the data that is to be shown in this column." } ),
			"format": { "type": "format", "for": ["valuelist", "dataprovider"], "tags": { "doc" : "This format will be applied on the dataprovider's data before showing it in the table." } },
			"valuelist": { "type": "valuelist", "for": "dataprovider", "forFoundset": "foundset" },
			(...)
		},
	(...)

For information about documenting handlers see Documenting handlers and handler templates below,

Handlers

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" } 
        ],
		"private": true // since Servoy 8.3, optional, default is false
}

the The "private" configuration makes the handler only accessible through from Server Side Scripting. But , not by from the client/browser itself.

Documenting handlers and handler templates
Anchor
documentingHandlers
documentingHandlers

Handlers can be documented - for use inside the developer - using the following keys (these are used in properties view tooltip or when generating new handler methods):

  • doc (used to be description; describes when the handler will be called and what it's for)
  • code (when a new method  is created for that handler, this default code template will be inserted)
  • for return value details returns can be an object with sub-keys: { type, doc, default (only relevant if "code" was not given) }
  • for parameter details parameters: [ { doc, optional (is false by default) } ].

For example:

Code Block
languagejs
"onDataChange": {
        "returns":  { "type": "boolean", "doc": "if it returns true then the data change is considered to be valid, otherwise it will be blocked/reverted by the component", "default": true },
        "parameters": [
            { "name": "newValue", "type": "string", "doc": "the new value entered by the user" },
            { "name": "oldValue", "type": "string", "optional": true, "doc": "the previous value if available" } 
        ],
		"doc": "<b>onDataChange</b> will be called if the user modified the field's content and then either tabbed out/clicked outside of the field or hit enter. The handler can decide wether to allow the change or not.",
		"code": "// if we set this we should remove the 'default' from 'returns'\nreturn !!newValue;"
}

For information about documenting properties see Documenting what properties do above,

Api

This section defines the signatures and behaviors of functions that can be called from the solution on this component/service.

...