Abstract Class sap.ui.model.BindingModule: sap/ui/model/Binding


The Binding is the object, which holds the necessary information for a data binding, like the binding path and the binding context, and acts like an interface to the model for the control, so it is the event provider for changes in the data model and provides getters for accessing properties or lists.

Constructor Summary
new sap.ui.model.Binding(oModel, sPath, oContext, mParameters?)Constructor for Binding class.
Event Summary
change(oEvent)The 'change' event is fired, when the data of the Binding is changed from the model.
dataReceived(oEvent)The 'dataReceived' event is fired, when data was received from a backend.
dataRequested(oEvent)The 'dataRequested' event is fired, when data was requested from a backend.
Method Summary
sap.ui.model.Binding.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.Binding with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.Binding.getMetadata()Returns a metadata object for class sap.ui.model.Binding.
attachAggregatedDataStateChange(fnFunction, oListener?)Attach event-handler fnFunction to the 'AggregatedDataStateChange' event of this sap.ui.model.Binding.
attachChange(fnFunction, oListener?)Attach event-handler fnFunction to the 'change' event of this sap.ui.model.Model.
attachDataReceived(fnFunction, oListener?)Attach event-handler fnFunction to the 'dataReceived' event of this sap.ui.model.Binding.
attachDataRequested(fnFunction, oListener?)Attach event-handler fnFunction to the 'dataRequested' event of this sap.ui.model.Binding.
attachDataStateChange(fnFunction, oListener?)Attach event-handler fnFunction to the 'DataStateChange' event of this sap.ui.model.Binding.
attachEvents(oEvents)Attach multiple events.
attachRefresh(fnFunction, oListener?)Attach event-handler fnFunction to the 'refresh' event of this sap.ui.model.Binding.
destroy()Removes all control messages for this binding from the MessageManager in addition to the standard clean-up tasks.
detachAggregatedDataStateChange(fnFunction, oListener?)Detach event-handler fnFunction from the 'AggregatedDataStateChange' event of this sap.ui.model.Binding.
detachChange(fnFunction, oListener?)Detach event-handler fnFunction from the 'change' event of this sap.ui.model.Model.
detachDataReceived(fnFunction, oListener?)Detach event-handler fnFunction from the 'dataReceived' event of this sap.ui.model.Binding.
detachDataRequested(fnFunction, oListener?)Detach event-handler fnFunction from the 'dataRequested' event of this sap.ui.model.Binding.
detachDataStateChange(fnFunction, oListener?)Detach event-handler fnFunction from the 'DataStateChange' event of this sap.ui.model.Binding.
detachEvents(oEvents)Detach multiple events-
detachRefresh(fnFunction, oListener?)Detach event-handler fnFunction from the 'refresh' event of this sap.ui.model.Binding.
fireDataReceived(mArguments)Fire event dataReceived to attached listeners.
fireDataRequested(mArguments)Fire event dataRequested to attached listeners.
initialize()Initialize the binding.
isInitial()Returns whether the binding is initial, which means it did not get an initial value yet
isRelative()Returns whether the binding is relative, which means it did not start with a /
isSuspended()Returns true if the binding is suspended or false if not.
refresh(bForceUpdate)Refreshes the binding, check whether the model data has been changed and fire change event if this is the case.
resume()Resumes the binding update.
suspend()Suspends the binding update.
updateRequired(oModel)Determines if the binding should be updated by comparing the current model against a specified model.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.Binding(oModel, sPath, oContext, mParameters?)
Constructor for Binding class.
Parameters:
{sap.ui.model.Model}oModel the model
{String}sPath the path
{sap.ui.model.Context}oContext the context object
{object}mParameters?
Event Detail
change(oEvent)
The 'change' event is fired, when the data of the Binding is changed from the model. The reason parameter of the event provides a hint where the change came from.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oEvent
{sap.ui.base.EventProvider}oEvent.getSource
{object}oEvent.getParameters
{string}oEvent.getParameters.reason? A string stating the reason for the data change. Can be any string and new values can be added in the future.
dataReceived(oEvent)
The 'dataReceived' event is fired, when data was received from a backend. This event may also be fired when an error occured.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oEvent
{sap.ui.base.EventProvider}oEvent.getSource
{object}oEvent.getParameters
{string}oEvent.getParameters.data? The data received. In error cases it will be undefined.
dataRequested(oEvent)
The 'dataRequested' event is fired, when data was requested from a backend.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oEvent
{sap.ui.base.EventProvider}oEvent.getSource
{object}oEvent.getParameters
Method Detail
sap.ui.model.Binding.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.Binding 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.EventProvider.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.model.Binding.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.Binding.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachAggregatedDataStateChange(fnFunction, oListener?)
Attach event-handler fnFunction to the 'AggregatedDataStateChange' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
attachChange(fnFunction, oListener?)
Attach event-handler fnFunction to the 'change' event of this sap.ui.model.Model.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
attachDataReceived(fnFunction, oListener?)
Attach event-handler fnFunction to the 'dataReceived' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
attachDataRequested(fnFunction, oListener?)
Attach event-handler fnFunction to the 'dataRequested' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
attachDataStateChange(fnFunction, oListener?)
Attach event-handler fnFunction to the 'DataStateChange' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
attachEvents(oEvents)
Attach multiple events.
Parameters:
{object}oEvents
attachRefresh(fnFunction, oListener?)
Attach event-handler fnFunction to the 'refresh' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
destroy()
Removes all control messages for this binding from the MessageManager in addition to the standard clean-up tasks.
See:
sap.ui.base.EventProvider#destroy
detachAggregatedDataStateChange(fnFunction, oListener?)
Detach event-handler fnFunction from the 'AggregatedDataStateChange' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
detachChange(fnFunction, oListener?)
Detach event-handler fnFunction from the 'change' event of this sap.ui.model.Model.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
detachDataReceived(fnFunction, oListener?)
Detach event-handler fnFunction from the 'dataReceived' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
detachDataRequested(fnFunction, oListener?)
Detach event-handler fnFunction from the 'dataRequested' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
detachDataStateChange(fnFunction, oListener?)
Detach event-handler fnFunction from the 'DataStateChange' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
detachEvents(oEvents)
Detach multiple events-
Parameters:
{object}oEvents
detachRefresh(fnFunction, oListener?)
Detach event-handler fnFunction from the 'refresh' event of this sap.ui.model.Binding.
Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener? object on which to call the given function.
fireDataReceived(mArguments)
Fire event dataReceived to attached listeners. This event may also be fired when an error occured.
Parameters:
{Map}mArguments the arguments to pass along with the event.
{object}mArguments.data? the data received. In error cases it will be undefined.
fireDataRequested(mArguments)
Fire event dataRequested to attached listeners.
Parameters:
{Map}mArguments the arguments to pass along with the event.
initialize()
Initialize the binding. The message should be called when creating a binding. The default implementation calls checkUpdate(true).
isInitial(): boolean
Returns whether the binding is initial, which means it did not get an initial value yet
Returns:
{boolean} whether binding is initial
isRelative(): boolean
Returns whether the binding is relative, which means it did not start with a /
Returns:
{boolean} whether binding is relative
isSuspended(): boolean
Returns true if the binding is suspended or false if not.
Returns:
{boolean} whether binding is suspended
refresh(bForceUpdate)
Refreshes the binding, check whether the model data has been changed and fire change event if this is the case. For server side models this should refetch the data from the server. To update a control, even if no data has been changed, e.g. to reset a control after failed validation, please use the parameter bForceUpdate.
Parameters:
{boolean}bForceUpdate Update the bound control even if no data has been changed
resume()
Resumes the binding update. Change events will be fired again.

When the binding is resumed, a change event will be fired immediately, if the data has changed while the binding was suspended. For serverside models, a request to the server will be triggered, if a refresh was requested while the binding was suspended.

suspend()
Suspends the binding update. No change events will be fired.

A refresh call with bForceUpdate set to true will also update the binding and fire a change in suspended mode. Special operations on bindings, which require updates to work properly (as paging or filtering in list bindings) will also update and cause a change event although the binding is suspended.

updateRequired(oModel): boolean
Determines if the binding should be updated by comparing the current model against a specified model.
Parameters:
{object}oModel The model instance to compare against
Returns:
{boolean} true if this binding should be updated