class sap.ui.core.mvc.ControllerExtension

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/mvc/ControllerExtension
Application Component: CA-UI5-COR

Base class for controller extensions.

All controller extensions must extend from this base class. It provides access to the view of the extended controller as well as to the view's controls.

For a more detailed description how to develop controller extensions, see section Using Controller Extension in the documentation.


Constructor


Methods Overview

Method Description
byId

Returns an Element of the connected view with the given local ID.

Views automatically prepend their own ID as a prefix to created Elements to make the IDs unique even in the case of multiple view instances. For a controller extension, the namespace of the control ID gets also prefixed with the namespace of the extension. This method helps to find an element by its local ID only.

If no view is connected or if the view doesn't contain an element with the given local ID, undefined is returned.

sap.ui.core.mvc.ControllerExtension.extend

Creates a new subclass of class sap.ui.core.mvc.ControllerExtension with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

sap.ui.core.mvc.ControllerExtension.getMetadata

Returns a metadata object for class sap.ui.core.mvc.ControllerExtension.

getView

Returns the View from the corresponding controller.

sap.ui.core.mvc.ControllerExtension.override

Override the ControllerExtension class with the given custom extension definition.

Only public methods that are not final could be overridden. The lifecycle methods onInit, onExit, onBeforeRendering and onAfterRendering are added before or after the lifecycle functions of the original extension.

Example for oExtension:

{
    onInit: function() {
        ...
    },
    ...
}

Note: This static method is automatically propagated to subclasses of ControllerExtension.

byId

Returns an Element of the connected view with the given local ID.

Views automatically prepend their own ID as a prefix to created Elements to make the IDs unique even in the case of multiple view instances. For a controller extension, the namespace of the control ID gets also prefixed with the namespace of the extension. This method helps to find an element by its local ID only.

If no view is connected or if the view doesn't contain an element with the given local ID, undefined is returned.

Param Type DefaultValue Description
sId string

View-local ID

sap.ui.core.mvc.ControllerExtension.extend

Creates a new subclass of class sap.ui.core.mvc.ControllerExtension with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

sap.ui.core.mvc.ControllerExtension.getMetadata

Returns a metadata object for class sap.ui.core.mvc.ControllerExtension.

getView

Returns the View from the corresponding controller.

sap.ui.core.mvc.ControllerExtension.override

Override the ControllerExtension class with the given custom extension definition.

Only public methods that are not final could be overridden. The lifecycle methods onInit, onExit, onBeforeRendering and onAfterRendering are added before or after the lifecycle functions of the original extension.

Example for oExtension:

{
    onInit: function() {
        ...
    },
    ...
}

Note: This static method is automatically propagated to subclasses of ControllerExtension.

Param Type DefaultValue Description
oExtension object

The custom extension definition