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 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)}
|
...
Arguments:
- actionPerformer - [component] reference 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 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)
...