Show TOC

Binding EventsLocate this document in the navigation structure

The OData V4 model supports certain events intended for applications, and others that are to be used for controls, as outlined in this section.

Events for Applications: dataRequested and dataReceived
The dataRequested and dataReceived events are meant for applications. Typically, these events are used to display and hide a busy indicator or to process a back-end error which happened when requesting data. The events are fired by ODataPropertyBinding, ODataContextBinding and ODataListBinding:
  • The dataRequested event is fired directly after data has been requested from a back end.

  • The dataReceived event is fired after the back-end data has been processed. Note that the dataReceived event is also fired after a back-end request has failed. The error of the failed request is passed to the event handler as an error parameter.

For more details, see the corresponding API documentation for the specific bindings ODataPropertyBinding, ODataContextBinding and ODataListBinding in the Demo Kit.
Events for Controls: change and refresh
The events change and refresh are meant for controls. They indicate that the respective binding has new data which can be accessed by the control:
  • When the binding is initialized, it fires a change event with the parameter reason set to sap.ui.model.ChangeReason.Change.

  • When a relative binding gets a new context, it fires a change event with the parameter reason set to sap.ui.model.ChangeReason.Context.

  • When a binding is refreshed, the event fired depends on the binding type, as follows:

    a) ODataPropertyBinding and ODataContextBinding fire a change event with the parameter reason set to sap.ui.model.ChangeReason.Refresh.

    b) ODataListBinding fires a refresh event.

For more details, see the corresponding API documentation for the specific bindings ODataPropertyBinding, ODataContextBinding and ODataListBinding, as well as sap.ui.model.ChangeReason in the Demo Kit.