class sap.ui.core.routing.Target

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

Provides a convenient way for placing views into the correct containers of your application.

The main benefit of Targets is lazy loading: you do not have to create the views until you really need them.


Constructor

Don't call this constructor directly, use sap.ui.core.routing.Targets instead, it will create instances of a Target.
If you are using the mobile library, please use the sap.m.routing.Targets constructor, please read the documentation there.

new sap.ui.core.routing.Target(oOptions, oCache, oParent?)
Param Type Default Value Description
oOptions object

all of the parameters defined in sap.m.routing.Targets#constructor are accepted here, except for children you need to specify the parent.

oCache sap.ui.core.routing.TargetCache

All views required by this target will get created by the views instance using sap.ui.core.routing.Views#getView

oParent? sap.ui.core.routing.Target

the parent of this target. Will also get displayed, if you display this target. In the config you have the fill the children property sap.m.routing.Targets#constructor


Events Overview

Event Description
display

Will be fired when a target is displayed

Could be triggered by calling the display function or by the @link sap.ui.core.routing.Router when a target is referenced in a matching route.

display

Will be fired when a target is displayed

Could be triggered by calling the display function or by the @link sap.ui.core.routing.Router when a target is referenced in a matching route.

Param Type Description
oEvent object
getSource sap.ui.base.EventProvider
getParameters object
view object

The view that got displayed.

control object

The control that now contains the view in the controlAggregation

config object

The options object passed to the constructor sap.ui.core.routing.Target#constructor

data object

The data passed into the sap.ui.core.routing.Target#display function

routeRelevant object

Whether the target is relevant to the matched route or not


Methods Overview

Method Description
_beforePlacingViewIntoContainer

This function is called between the target view is loaded and the view is added to the container.

This function can be used for applying modification on the view or the container to make the rerendering occur together with the later aggregation change.

attachDisplay

Attaches event handler fnFunction to the display event of this sap.ui.core.routing.Target.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.routing.Target itself.

destroy

Destroys the target, will be called by sap.m.routing.Targets don't call this directly.

detachDisplay

Detaches event handler fnFunction from the display event of this sap.ui.core.routing.Target.

The passed function and listener object must match the ones used for event registration.

display

Creates a view and puts it in an aggregation of a control that has been defined in the sap.ui.core.routing.Target#constructor.

sap.ui.core.routing.Target.extend

Creates a new subclass of class sap.ui.core.routing.Target 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.EventProvider.extend.

fireDisplay

Fires event created to attached listeners.

sap.ui.core.routing.Target.getMetadata

Returns a metadata object for class sap.ui.core.routing.Target.

suspend

Suspends the object which is loaded by the target.

Currently this function stops the router of the component when the object which is loaded by this target is an instance of UIComponent. This is done only when the target is already loaded. When the target is not loaded yet or still being loaded, the router of the component isn't stopped.

_beforePlacingViewIntoContainer

This function is called between the target view is loaded and the view is added to the container.

This function can be used for applying modification on the view or the container to make the rerendering occur together with the later aggregation change.

Param Type DefaultValue Description
mArguments object

the object containing the arguments

container sap.ui.core.Control

the container where the view will be added

view sap.ui.core.Control

the view which will be added to the container

data object

the data passed from sap.ui.core.routing.Target#display method

attachDisplay

Attaches event handler fnFunction to the display event of this sap.ui.core.routing.Target.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.core.routing.Target itself.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function

The function to be called, when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.core.routing.Target itself

destroy

Destroys the target, will be called by sap.m.routing.Targets don't call this directly.

detachDisplay

Detaches event handler fnFunction from the display event of this sap.ui.core.routing.Target.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

display

Creates a view and puts it in an aggregation of a control that has been defined in the sap.ui.core.routing.Target#constructor.

Param Type DefaultValue Description
vData any

an object that will be passed to the display event in the data property. If the target has parents, the data will also be passed to them.

sap.ui.core.routing.Target.extend

Creates a new subclass of class sap.ui.core.routing.Target 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.EventProvider.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

fireDisplay

Fires event created to attached listeners.

Param Type DefaultValue Description
oParameters object

Parameters to pass along with the event

sap.ui.core.routing.Target.getMetadata

Returns a metadata object for class sap.ui.core.routing.Target.

suspend

Suspends the object which is loaded by the target.

Currently this function stops the router of the component when the object which is loaded by this target is an instance of UIComponent. This is done only when the target is already loaded. When the target is not loaded yet or still being loaded, the router of the component isn't stopped.