IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Create user interfaces for business processes > Coach and Coach View reference information > Event handlers

The view event handler

This view function performs logic such as populating the view with data before the user can see the view.


Usage

Use the view function to perform logic before the view is rendered.

For example, you can show or hide labels depending on the visibility setting.


Parameters

The view function does not take any parameters.

By default, if visibility is not set for the view, it will inherit its parent's visibility. If you want to have your own view logic in addition to the default logic of the view() method, you can invoke the super-class view logic inside your view() function by using the syntax this.constructor.prototype.view.call(this);


Sample

The following code in the view() function checks the setting of the visibility property on an output text control, and based on the value of the property, sets the display to true or false. If that if visibility is not set for a view, it will inherit its parent's visibility.
var labelDiv = this.context.element.querySelector(".outputTextLabel");

if (this.context.options._metadata.label == undefined ||
    this.context.options._metadata.label.get("value") == "" ||
    (this.context.options._metadata.labelVisibility != undefined &&
     this.context.options._metadata.labelVisibility.get("value") == "NONE")) {
	// hide the label div
	this.context.setDisplay(false, labelDiv);} else {
	// show the label div
	this.context.setDisplay(true, labelDiv);}

Event handlers


Related reference:
The load event handler
The unload event handler
The change event handler
The collaboration event handler
The validate event handler