The view object (this)

The view object represents a coach view and is a self-contained runtime JavaScript object that can render itself in a browser.

When you are editing JavaScript in a coach view editor, the this keyword refers to the coach view.
IBM BPM version 8570 cumulative fix 3

Functions in the view object

You can access the following functions through the view object:

Table 1. Functions in the view object
Function Parameters Description
getData   Retrieves bound data that is associated with this coach view. The function works only for coach views with bound data.
Returned value
The getData function returns the value of the bound data as a JavaScript object. If there is no binding for the coach view, the returned value is undefined.
Example
var dec1 = <viewRef>.getData();
getOption
optionName (String)
The name of the option
Retrieves the option that is associated with this coach view.
Returned value
The getOption function returns the value of an option as a JavaScript object. If no such option exists or the option is not set for the coach view, the returned value is undefined.
Example
var dec1 = <viewRef>.getOption('option1');
setData
data (Object)
The value of the bound data. This parameter type must match the type of the bound data. No type checking is performed.
Updates the binding that is associated with this coach view. The setData function works only for coach views with binding. If the coach view has no binding, a warning is logged in the browser console and the exception is re-thrown to the caller.
Example
<viewRef>.setData("TEST");
setOption
optionName (String)
The name of the option
optionValue (Object)
The value of the option. The type of this parameter must match the option type. No type checking is performed. Also, the option must be bound to a variable, and the binding cannot be static.
Updates the option data that is associated with the coach view. The setOption function works only for coach views with the specified option. If the coach view has no such option, a warning is logged in the browser console and the exception is re-thrown to the caller.
Example
<viewRef>.setOption("option1", "TestValue1");
getLabel   Retrieves the label value of the coach view.
Returned value
The getLabel function returns the label value of the coach view as a JavaScript string, htmlEscaped. If the view has no label, the returned value is undefined.
Example
var dec1 = <viewRef>.getLabel();
isLabelVisible   Returns a Boolean value to indicate whether the label is visible.
Returned value
The isLabelVisible function returns the label visibility status as a Boolean value. The returned value is false if labelVisibility is 'HIDDEN', or undefined. Otherwise, the returned value is true.
Example
var labelVisible = <viewRef>.isLabelVisible();
getLabelVisibility   Retrieves the label visibility setting of the coach view.
Returned value
The getLabelVisibility function returns the label visibility as a list of possible JavaScript string values, such as 'SHOW' and 'HIDE'. If no label visibility setting exists, the returned value is undefined.
Example
var labelVisible = <viewRef>.getLabelVisibility();
isVisible   Checks whether the coach view is visible.
Returned value
The isVisible function returns the visibility status adjusted based on the visibility of the parent view (Boolean). The returned value is false if visibility is set to 'NONE' or 'HIDDEN'. Otherwise, the returned value is true.
Example
var visible = <viewRef>.isVisible();
getVisibility   Returns the actual visibility of a coach view. It adjusts its value based on the visibility of the parent view.
Returned value
The getVisibility function returns the visibility of the coach view as a list of possible JavaScript string values, such as 'REQUIRED', 'EDITABLE', 'READONLY', 'NONE', and 'HIDDEN'. It adjusts its value based on the visibility of the parent view.
Example
var visible = <viewRef>.getVisibility();
getBaseTextDirection   Retrieves the baseTextDirection setting of the coach view.
Returned value
It returns the baseTextDirection setting of the coach view as a list of possible JavaScript string values, such as 'DEFAULT', 'CONTEXTUAL', 'LTR', and 'RTL'. If no such setting is set for the coach view, a 'DEFAULT' string is returned.
Example
var dec1 = <viewRef>.getBaseTextDirection();
getHelpText   Retrieves the help text of the coach view.
Returned value
The getHelpText function returns the helpText value of the coach view as a JavaScript string, htmlEscaped. If the coach view has no help text, it returns a null value.
Example
var dec1 = <viewRef>.getHelpText();