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.
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
refresh(sGroupId?)Refreshes this binding; refresh is supported for absolute bindings only. 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. toString()Returns a string representation of this object including the binding path. attachAggregatedDataStateChange,
attachChange,
attachDataReceived,
attachDataRequested,
attachDataStateChange,
attachEvents,
attachRefresh,
destroy,
detachAggregatedDataStateChange,
detachChange,
detachDataReceived,
detachDataRequested,
detachDataStateChange,
detachEvents,
detachRefresh,
fireDataReceived,
fireDataRequested,
initialize,
isRelative,
isSuspended,
updateRequired 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:
- Since:
- 1.37.0
See:
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:
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:
- Since:
- 1.37.0
See:
Method Detail
getValue(): any
Returns the current value.
- Since:
- 1.37.0
Returns:
See:
isInitial()
Method not supported
- Since:
- 1.37.0
Exceptions:
See:
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:
- Since:
- 1.37.0
Exceptions:
{Error} | If the given group ID is invalid or refresh on this binding is not supported. |
See:
resume()
Method not supported
- Since:
- 1.37.0
Exceptions:
See:
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:
setValue(vValue, sGroupId?)
Sets the new current value and updates the cache.
Parameters:
- Since:
- 1.37.0
Exceptions:
{Error} | If the new value is not primitive or the binding is not relative |
See:
suspend()
Method not supported
- Since:
- 1.37.0
Exceptions:
See:
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 |