namespace sap.ui.core.Element.registry

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

Registry of all sap.ui.core.Elements that currently exist.


Nodes Overview

Node Description

Methods Overview

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

Return an object with all instances of sap.ui.core.Element, 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.Element.registry.filter

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

The expected signature of the callback is

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

If elements are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When an element 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 elements matching the given predicate. The order of the elements in the array is not specified and might change between calls (over time and across different versions of UI5).

sap.ui.core.Element.registry.forEach

Calls the given callback for each element.

The expected signature of the callback is

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

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

If elements are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When an element 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.Element.registry.get

Retrieves an Element by its ID.

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

sap.ui.core.Element.registry.all

Return an object with all instances of sap.ui.core.Element, 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.Element.registry.filter

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

The expected signature of the callback is

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

If elements are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When an element 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 elements matching the given predicate. The order of the elements 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.Element,sap.ui.core.ID) : boolean

predicate against which each element is tested

thisArg Object

context object to provide as this in each call of callback

sap.ui.core.Element.registry.forEach

Calls the given callback for each element.

The expected signature of the callback is

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

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

If elements are created or destroyed within the callback, then the behavior is not specified. Newly added objects might or might not be visited. When an element 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.Element,sap.ui.core.ID)

Function to call for each element

thisArg Object

Context object to provide as this in each call of callback

sap.ui.core.Element.registry.get

Retrieves an Element by its ID.

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

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

ID of the element to retrieve