abstract class sap.ui.model.Context

Control sample: sap.ui.model.Context
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/model/Context
Application Component: CA-UI5-COR

The Context is a pointer to an object in the model data. A relative binding needs a context as a reference point in order to resolve its path; without a context, a relative binding is unresolved and does not point to model data. Context instances can, for example, be created in the following ways:

For more information on the concept of data binding and binding contexts, see documentation on binding syntax.


Constructor

Constructor for Context class.

new sap.ui.model.Context(oModel, sPath)
Param Type Default Value Description
oModel sap.ui.model.Model

the model

sPath string

the binding path


Methods Overview

Method Description
sap.ui.model.Context.extend

Creates a new subclass of class sap.ui.model.Context 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.

getMessages

Returns messages associated with this context, that is messages belonging to the object referred to by this context or a child object of that object. The messages are sorted by their type according to the type's severity in a way that messages with highest severity come first.

References:

  • sap.ui.model.Model#getMessages

sap.ui.model.Context.getMetadata

Returns a metadata object for class sap.ui.model.Context.

getModel

Getter for model

getObject

Gets the (model dependent) object the context points to or the object with the given relative binding path

getPath

Getter for path of the context itself or a subpath

getProperty

Gets the property with the given relative binding path

isPreliminary

This method returns, whether the context is preliminary.

Since since 1.93.0; only supported by the OData V2 Model; use V2 specific Context instead

sap.ui.model.Context.extend

Creates a new subclass of class sap.ui.model.Context 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

getMessages

Returns messages associated with this context, that is messages belonging to the object referred to by this context or a child object of that object. The messages are sorted by their type according to the type's severity in a way that messages with highest severity come first.

References:

sap.ui.model.Context.getMetadata

Returns a metadata object for class sap.ui.model.Context.

getModel

Getter for model

getObject

Gets the (model dependent) object the context points to or the object with the given relative binding path

Param Type DefaultValue Description
sPath string

the binding path

mParameters object

additional model specific parameters (optional)

getPath

Getter for path of the context itself or a subpath

Param Type DefaultValue Description
sPath string

the binding path (optional)

getProperty

Gets the property with the given relative binding path

Param Type DefaultValue Description
sPath string

the binding path

isPreliminary

This method returns, whether the context is preliminary.

Since since 1.93.0; only supported by the OData V2 Model; use V2 specific Context instead