Script
Learn about custom scripts needed for custom components.
With every custom component you create you must use a custom script. Files with custom scripts are specified in the action
property of the UI configuration for a component.
async
methods on this object.General
In this example, the API path and UI configuration of the current custom component is shown, and then two call alerts on the UI client.
log
setEnabled
This method allows a change to the enabled state of control (must be used only with custom buttons).
setVisibility
This method allows a change in the visibility of the control state.
setHtml
Set widget's internal HTML (can be used only with custom view).
setChildHtml
setHeight
setWidth
setToolTip
Set widget's tooltip.
onAction
@deprecated
: Use UI.onEvent(...)
and listen for event "execute"
instead.
The entry point of the script. When the all scripts are loaded, then the on action is invoked (can be used only with custom buttons and menu items/actions).
onEvent
The entry point of the script when a new event is thrown.
"execute"
: when you click a custom button or menu item."data"
is null."updateEntity"
: when a new entity is loaded from API."data"
is JSON of the entity."changeSearchQuery"
: when search criteria are changed."data"
is string with search query."changeVisibility"
: when visibility of custom component is changed."data"
istrue
orfalse
."uiAction"
: when specified ui action occurs on DOM element of custom view."data"
is JSON: {type:uiAction
, id:id
, event:event
}.uiAction
: name of action ("click"
,"mousemove"
,"mousedown"
, etc.).id
: id of target DOM element.event
: clone of javascript event object.
getEntityURI
This method allows a get
of the current entity uri.
getEntity
This method allows a get
of the current entity.
getApiPath
This method allows a get
of the api path url.
getSearchQuery
This method allows a get
of the current search query.
getTenant
The method allows a get
of the current tenant name.
getPerspective
This method allows a get
of the current perspective id.
setPerspective
set
to the current perspective.setEntityUri
set
to the entity uri.api
alert
This method allows showing the alert box with text.
confirm
prompt
This method allows showing the prompt box.
getConfiguration
Get metadata configuration.
getUiConfiguration
Get UI configuration of current custom component.
openSearch
Open search screen with some state.