Class sap.ui.model.odata.v4.ODataPropertyBindingModule: sap/ui/model/odata/v4/ODataPropertyBinding


Property binding for an OData V4 model. An event handler can only be attached to this binding for the following events: 'change', 'dataReceived', and 'dataRequested'. For other events, an error is thrown.

Constructor Summary
new sap.ui.model.odata.v4.ODataPropertyBinding(oModel, sPath, oContext?, mParameters?)DO NOT CALL this private constructor for a new ODataPropertyBinding, but rather use bindProperty instead!
Event Summary
change(oEvent)The 'change' event is fired when the binding is initialized or refreshed or its type is changed or its parent context is changed.
dataReceived(oEvent)The 'dataReceived' event is fired after the back end data has been processed and the registered 'change' event listeners have been notified.
dataRequested(oEvent)The 'dataRequested' event is fired directly after data has been requested from a back end.
Method Summary
getValue()Returns the current value.
isInitial()Method not supported
refresh(sGroupId?)Refreshes this binding; refresh is supported for absolute bindings only.
resume()Method not supported
setType(oType, sInternalType)Sets the optional type and internal type for this binding; used for formatting and parsing.
setValue(vValue, sGroupId?)Sets the new current value and updates the cache.
suspend()Method not supported
toString()Returns a string representation of this object including the binding path.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.v4.ODataPropertyBinding(oModel, sPath, oContext?, mParameters?)
DO NOT CALL this private constructor for a new ODataPropertyBinding, but rather use bindProperty instead!
Parameters:
{sap.ui.model.odata.v4.ODataModel}oModel The OData V4 model
{string}sPath The binding path in the model; must not be empty or end with a slash
{sap.ui.model.Context}oContext? The context which is required as base for a relative path
{object}mParameters? Map of binding parameters which can be OData query options as specified in "OData Version 4.0 Part 2: URL Conventions" or the binding-specific parameters "$$groupId" and "$$updateGroupId". Note: Binding parameters may only be provided for absolute binding paths as only those lead to a data service request. All "5.2 Custom Query Options" are allowed except for those with a name starting with "sap-". All other query options lead to an error. Query options specified for the binding overwrite model query options.
{string}mParameters.$$groupId? The group ID to be used for read requests triggered by this binding; if not specified, the model's group ID is used, see sap.ui.model.odata.v4.ODataModel. Valid values are undefined, '$auto', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel#submitBatch.
{string}mParameters.$$updateGroupId? The group ID to be used for update requests triggered by this binding; if not specified, the model's update group ID is used, see sap.ui.model.odata.v4.ODataModel. For valid values, see parameter "$$groupId".
Exceptions:
{Error}
If disallowed binding parameters are provided
Event Detail
change(oEvent)
The 'change' event is fired when the binding is initialized or refreshed or its type is changed or its parent context is changed. It is to be used by controls to get notified about changes to the value of this property binding. Registered event handlers are called with the change reason as parameter.
Parameters:
{sap.ui.base.Event}oEvent
{object}oEvent.getParameters
{sap.ui.model.ChangeReason}oEvent.getParameters.reason The reason for the 'change' event: Change when the binding is initialized, Refresh when the binding is refreshed, and Context when the parent context is changed
Since:
1.37.0
See:
sap.ui.base.Event
dataReceived(oEvent)
The 'dataReceived' event is fired after the back end data has been processed and the registered 'change' event listeners have been notified. It is to be used by applications for example to switch off a busy indicator or to process an error.

If back end requests are successful, the event has no parameters. The response data is available in the model. Note that controls bound to this data may not yet have been updated; it is thus not safe for registered event handlers to access data via control APIs.

If a back end request fails, the 'dataReceived' event provides an Error in the 'error' event parameter.

Parameters:
{sap.ui.base.Event}oEvent
{object}oEvent.getParameters
{Error}oEvent.getParameters.error? The error object if a back end request failed. If there are multiple failed back end requests, the error of the first one is provided.
Since:
1.37.0
See:
sap.ui.base.Event
dataRequested(oEvent)
The 'dataRequested' event is fired directly after data has been requested from a back end. It is to be used by applications for example to switch on a busy indicator. Registered event handlers are called without parameters.
Parameters:
{sap.ui.base.Event}oEvent
Since:
1.37.0
See:
sap.ui.base.Event
Method Detail
getValue(): any
Returns the current value.
Since:
1.37.0
Returns:
{any} The current value
See:
sap.ui.model.PropertyBinding#getValue
isInitial()
Method not supported
Since:
1.37.0
Exceptions:
{Error}
See:
sap.ui.model.Binding#isInitial
refresh(sGroupId?)
Refreshes this binding; refresh is supported for absolute bindings only. A refresh retrieves data from the server using the given group ID and fires a change event when new data is available.

Note: When calling refresh multiple times, the result of the request triggered by the last call determines the binding's data; it is independent of the order of calls to sap.ui.model.odata.v4.ODataModel#submitBatch with the given group ID.

Parameters:
{string}sGroupId? The group ID to be used for refresh; if not specified, the group ID for this binding is used, see sap.ui.model.odata.v4.ODataPropertyBinding. Valid values are undefined, '$auto', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel#submitBatch.
Since:
1.37.0
Exceptions:
{Error} If the given group ID is invalid or refresh on this binding is not supported.
See:
sap.ui.model.Binding#refresh
resume()
Method not supported
Since:
1.37.0
Exceptions:
{Error}
See:
sap.ui.model.Binding#resume
setType(oType, sInternalType)
Sets the optional type and internal type for this binding; used for formatting and parsing. Fires a change event if the type has changed.
Parameters:
{sap.ui.model.Type}oType The type for this binding
{string}sInternalType The internal type of the element property which owns this binding, for example "any", "boolean", "float", "int", "string"; see sap.ui.model.odata.type for more information
See:
sap.ui.model.PropertyBinding#setType
setValue(vValue, sGroupId?)
Sets the new current value and updates the cache.
Parameters:
{any}vValue The new value which must be primitive
{string}sGroupId? The group ID to be used for this update call; if not specified, the update group ID for this binding (or its relevant parent binding) is used, see sap.ui.model.odata.v4.ODataPropertyBinding. Valid values are undefined, '$auto', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel#submitBatch.
Since:
1.37.0
Exceptions:
{Error} If the new value is not primitive or the binding is not relative
See:
sap.ui.model.PropertyBinding#setValue
suspend()
Method not supported
Since:
1.37.0
Exceptions:
{Error}
See:
sap.ui.model.Binding#suspend
toString(): string
Returns a string representation of this object including the binding path. If the binding is relative, the parent path is also given, separated by a '|'.
Since:
1.37.0
Returns:
{string} A string description of this binding