namespace sap.ui.core.Component.registry

Visiblity: public
Available since: N/A
Module: sap/ui/core/Component
Application Component: CA-UI5-COR

Registry of all Components that currently exist.


Nodes Overview

Node Description

Methods Overview

Method Description
sap.ui.core.Component.registry.all

Return an object with all instances of sap.ui.core.Component, keyed by their ID.

Each call creates a new snapshot object. Depending on the size of the UI, this operation therefore might be expensive. Consider to use the forEach or filter method instead of executing similar operations on the returned object.

Note: The returned object is created by a call to Object.create(null), and therefore lacks all methods of Object.prototype, e.g. toString etc.

sap.ui.core.Component.registry.filter

Returns an array with components for which the given callback returns a value that coerces to true.

The expected signature of the callback is

   function callback(oComponent, sID)
where oComponent is the currently visited component instance and sID is the ID of that instance.

If components are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When a component is destroyed during the filtering and was not visited yet, it might or might not be visited. As the behavior for such concurrent modifications is not specified, it may change in newer releases.

If a thisArg is given, it will be provided as this context when calling callback. The this value that the implementation of callback sees, depends on the usual resolution mechanism. E.g. when callback was bound to some context object, that object wins over the given thisArg.

This function returns an array with all components matching the given predicate. The order of the components in the array is not specified and might change between calls (over time and across different versions of UI5).

sap.ui.core.Component.registry.forEach

Calls the given callback for each existing component.

The expected signature of the callback is

   function callback(oComponent, sID)
where oComponent is the currently visited component instance and sID is the ID of that instance.

The order in which the callback is called for components is not specified and might change between calls (over time and across different versions of UI5).

If components are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When a component is destroyed during the filtering and was not visited yet, it might or might not be visited. As the behavior for such concurrent modifications is not specified, it may change in newer releases.

If a thisArg is given, it will be provided as this context when calling callback. The this value that the implementation of callback sees, depends on the usual resolution mechanism. E.g. when callback was bound to some context object, that object wins over the given thisArg.

sap.ui.core.Component.registry.get

Retrieves a Component by its ID.

When the ID is null or undefined or when there's no Component with the given ID, then undefined is returned.

sap.ui.core.Component.registry.all

Return an object with all instances of sap.ui.core.Component, keyed by their ID.

Each call creates a new snapshot object. Depending on the size of the UI, this operation therefore might be expensive. Consider to use the forEach or filter method instead of executing similar operations on the returned object.

Note: The returned object is created by a call to Object.create(null), and therefore lacks all methods of Object.prototype, e.g. toString etc.

Param Type DefaultValue Description

sap.ui.core.Component.registry.filter

Returns an array with components for which the given callback returns a value that coerces to true.

The expected signature of the callback is

   function callback(oComponent, sID)
where oComponent is the currently visited component instance and sID is the ID of that instance.

If components are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When a component is destroyed during the filtering and was not visited yet, it might or might not be visited. As the behavior for such concurrent modifications is not specified, it may change in newer releases.

If a thisArg is given, it will be provided as this context when calling callback. The this value that the implementation of callback sees, depends on the usual resolution mechanism. E.g. when callback was bound to some context object, that object wins over the given thisArg.

This function returns an array with all components matching the given predicate. The order of the components in the array is not specified and might change between calls (over time and across different versions of UI5).

Param Type DefaultValue Description
callback function(sap.ui.core.Component,sap.ui.core.ID) : boolean

predicate against which each Component is tested

thisArg Object

context object to provide as this in each call of callback

sap.ui.core.Component.registry.forEach

Calls the given callback for each existing component.

The expected signature of the callback is

   function callback(oComponent, sID)
where oComponent is the currently visited component instance and sID is the ID of that instance.

The order in which the callback is called for components is not specified and might change between calls (over time and across different versions of UI5).

If components are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When a component is destroyed during the filtering and was not visited yet, it might or might not be visited. As the behavior for such concurrent modifications is not specified, it may change in newer releases.

If a thisArg is given, it will be provided as this context when calling callback. The this value that the implementation of callback sees, depends on the usual resolution mechanism. E.g. when callback was bound to some context object, that object wins over the given thisArg.

Param Type DefaultValue Description
callback function(sap.ui.core.Component,sap.ui.core.ID)

Function to call for each Component

thisArg Object

Context object to provide as this in each call of callback

sap.ui.core.Component.registry.get

Retrieves a Component by its ID.

When the ID is null or undefined or when there's no Component with the given ID, then undefined is returned.

Param Type DefaultValue Description
id sap.ui.core.ID

ID of the Component to retrieve