Table of Contents |
---|
...
7. Scripts
7.1. Overview
Scripts elements allows to develop simple client-side logic. Using scripts, developers can create basic view logic like enabling or disabling fields, change ribbon buttons, fire view events etc...
...
To insert script to component use xml 'script' tag:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<script> <![CDATA[ // SCRIPT BODY ]]> </script> |
You can add script to every component in system.
...
You can access oter components from inside script using construction:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#{referenceName}
|
Where
- referenceName - reference name of component to access
...
You can get translation using construction:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#{translate(translationKey)}
|
...
7.3. Component methods
7.3.1. commons
...
Anchor |
---|
...
arguments
...
returns
...
description
...
commons
...
...
...
|
addOnChangeListener(listener)
...
- listener - [object] listener to add
...
none
Adds listener to component. For more information see component events
...
addOnChangeListener(listener)
Adds listener to component. For more information see component events.
Arguments:
- listener - [object] listener to add
Returns:
none
fireEvent(actionPerformer, eventName, args)
Fires event on component.
Arguments:
- listener actionPerformer - [objectcomponent] listener to addreference to performer component
- eventName - [string] name of event
- args - [array] array of event arguments
Returns:
none
fireEvent(actionPerformer, {
name : eventName,
args : eventArgs,
callback : eventCallback
})
Fires event on component.
Arguments:
- actionPerformer - [component] reference to performer component (optional)
- eventName - [string] name of event
- args - [array] array array of event arguments (optional)
- eventCallback - [function] parameterless function which will be called after event handler completes its job. (optional)
Returns:
none
getValue()
Gets component value.
...
Arguments:
- header - [string] header content
Returns:
none
setActiveTab(tabName)
Shows tab with given name, regardless of its current visibility state.
Arguments:
- tabName - [string] name of the tab
Returns:
none
getTab(tabName)
Returns tab with given name.
Arguments:
- tabName - [string] name of the tab.
Returns:
window tab object (see next section) or 'undefined' if it doesn't exist.
7.3.3. window tab:
getRibbonItem(ribbonItemPath)
...
Returns:
- [object] ribbon object or null when no object found
setVisible(isVisible)
Depending on the argument's value shows or hides this tab from the window header.
Setting tab's visibility to true != activate tab. Visibility refers to presence tab name in the window header, while tab activation means focusing given tab.
If you set currently focused (active) tab to be not visible then the first visible tab (counting from the left) will be focused (activated).
Arguments:
- isVisible - [boolean] true if tab name should be displayed in the tabs list, at the window's header.
Returns:
none
7.3.4. form
setComponentLoading(isLoadingVisible)
...
Arguments:
- column - [string] name of column
- filterText - [string] filter value to insert
Returns:
none
7.3.6.
...
tree
setComponentLoading(isLoadingVisible)
...
To every component you can add listener using addOnChangeListener method. Listener object should have methods that will be executed when event is fired. Depends of component object different methods will be executed (see below)
7.
...
4.1. commons
onSetValue(value)
Executed when setValue method is executed on component.
Arguments:
- value - [object] value object
7.
...
4.
...
2. grid
onChange(selectedEntitiesArray)
...
Arguments:
- selectedEntitiesArray - [array] array of selected entities
7.4.3.
...
ribbon button
onClick()
Executed when ribbon button is clicked.
Arguments:
none
7.
...
4.
...
4. tree
onMoveModeChange(isMoveMode)
...