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 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. |
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. |
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. |
Method | Description |
---|---|
attachDataChanged |
Attaches event handler When called, the context of the event handler (its Event fired when new data is available. |
attachDataRequested |
Attaches event handler When called, the context of the event handler (its Event fired when new data is requested. |
attachError |
Attaches event handler When called, the context of the event handler (its Event fired when an error is thrown. |
detachDataChanged |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachDataRequested |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachError |
Detaches event handler 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
|
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 |
triggerDataUpdate |
Triggers a data update which results in either "dataChanged" event or an "error" event. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Fires event dataChanged to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
data | object |
The data JSON. |
Fires event dataRequested to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Fires event error to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
message | string |
The error message. |
Gets current value of property baseRuntimeUrl.
The base url where resources for card or editor are located.
Returns a metadata object for class sap.ui.integration.util.DataProvider.
Gets current value of property settingsJson.
Data settings in json format. Will override any other settings.
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 |