class sap.ui.integration.util.DataProvider

Visiblity: restricted
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/integration/util/DataProvider
Application Component: CA-UI5-CTR

Provides data for the card, card header and card content by reading the "data" part of the card manifest. Hides the complexity of working with different data providers like: - static JSON data - data services which implements the interface sap.ui.integration.services.Data class - AJAX calls like sap.ui.integration.cards.Data class Allows for an extensible way to add more data providers.


Constructor

Constructor for a new DataProvider.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.integration.util.DataProvider(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new data provider, generated automatically if no ID is given.

mSettings? object

Initial settings for the new data provider.


Properties

Name Type Default Value Description
baseRuntimeUrl string

The base url where resources for card or editor are located.

Visibility: public
settingsJson string

Data settings in json format. Will override any other settings.

Visibility: public

Events Overview

Event Description
dataChanged

Event fired when new data is available.

dataRequested

Event fired when new data is requested.

error

Event fired when an error is thrown.

dataChanged

Event fired when new data is available.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
data object

The data JSON.

dataRequested

Event fired when new data is requested.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

error

Event fired when an error is thrown.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
message string

The error message.


Methods Overview

Method Description
attachDataChanged

Attaches event handler fnFunction to the dataChanged event of this sap.ui.integration.util.DataProvider.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.integration.util.DataProvider itself.

Event fired when new data is available.

attachDataRequested

Attaches event handler fnFunction to the dataRequested event of this sap.ui.integration.util.DataProvider.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.integration.util.DataProvider itself.

Event fired when new data is requested.

attachError

Attaches event handler fnFunction to the error event of this sap.ui.integration.util.DataProvider.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.integration.util.DataProvider itself.

Event fired when an error is thrown.

detachDataChanged

Detaches event handler fnFunction from the dataChanged event of this sap.ui.integration.util.DataProvider.

The passed function and listener object must match the ones used for event registration.

detachDataRequested

Detaches event handler fnFunction from the dataRequested event of this sap.ui.integration.util.DataProvider.

The passed function and listener object must match the ones used for event registration.

detachError

Detaches event handler fnFunction from the error event of this sap.ui.integration.util.DataProvider.

The passed function and listener object must match the ones used for event registration.

sap.ui.integration.util.DataProvider.extend

Creates a new subclass of class sap.ui.integration.util.DataProvider 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.ManagedObject.extend.

fireDataChanged

Fires event dataChanged to attached listeners.

fireDataRequested

Fires event dataRequested to attached listeners.

fireError

Fires event error to attached listeners.

getBaseRuntimeUrl

Gets current value of property baseRuntimeUrl.

The base url where resources for card or editor are located.

getData

Triggers a data update and returns the result data.

sap.ui.integration.util.DataProvider.getMetadata

Returns a metadata object for class sap.ui.integration.util.DataProvider.

getSettingsJson

Gets current value of property settingsJson.

Data settings in json format. Will override any other settings.

setBaseRuntimeUrl

Sets a new value for property baseRuntimeUrl.

The base url where resources for card or editor are located.

When called with a value of null or undefined, the default value of the property will be restored.

triggerDataUpdate

Triggers a data update which results in either "dataChanged" event or an "error" event.

attachDataChanged

Attaches event handler fnFunction to the dataChanged event of this sap.ui.integration.util.DataProvider.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.integration.util.DataProvider itself.

Event fired when new data is available.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.integration.util.DataProvider itself

attachDataRequested

Attaches event handler fnFunction to the dataRequested event of this sap.ui.integration.util.DataProvider.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.integration.util.DataProvider itself.

Event fired when new data is requested.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.integration.util.DataProvider itself

attachError

Attaches event handler fnFunction to the error event of this sap.ui.integration.util.DataProvider.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.integration.util.DataProvider itself.

Event fired when an error is thrown.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.integration.util.DataProvider itself

detachDataChanged

Detaches event handler fnFunction from the dataChanged event of this sap.ui.integration.util.DataProvider.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachDataRequested

Detaches event handler fnFunction from the dataRequested event of this sap.ui.integration.util.DataProvider.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachError

Detaches event handler fnFunction from the error event of this sap.ui.integration.util.DataProvider.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.integration.util.DataProvider.extend

Creates a new subclass of class sap.ui.integration.util.DataProvider 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.ManagedObject.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

fireDataChanged

Fires event dataChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

data object

The data JSON.

fireDataRequested

Fires event dataRequested to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireError

Fires event error to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

message string

The error message.

getBaseRuntimeUrl

Gets current value of property baseRuntimeUrl.

The base url where resources for card or editor are located.

getData

Triggers a data update and returns the result data.

sap.ui.integration.util.DataProvider.getMetadata

Returns a metadata object for class sap.ui.integration.util.DataProvider.

getSettingsJson

Gets current value of property settingsJson.

Data settings in json format. Will override any other settings.

setBaseRuntimeUrl

Sets a new value for property baseRuntimeUrl.

The base url where resources for card or editor are located.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sBaseRuntimeUrl string

New value for property baseRuntimeUrl

triggerDataUpdate

Triggers a data update which results in either "dataChanged" event or an "error" event.