The app configures several data models that are used throughout the app to update the views or to store additional configuration options.
The service model and the resource bundle are instantiated automatically by the app’s component during startup and described in the first section. The local view models and helper models such as the device model are set up as JSON models and described in the second section.
The templates instantiate the service and resource model automatically using the following configuration entries in the descriptor. When the component of the app is initialized, these models will be made available under the configured name throughout the app.
{ … "sap.app": { … "i18n": "i18n/i18n.properties", … "dataSources": { "mainService": { "uri": "/here/goes/your/serviceUrl/" "type": "OData", "settings": { "odataVersion": "2.0", "localUri": "localService/metadata.xml" } } }, … }, … }
{ … "sap.ui5": { … "models": { "i18n": { "type": "sap.ui.model.resource.ResourceModel", "settings": { "bundleName": "sap.ui.demo.i18n.i18n" } }, "": { "dataSource": "mainService", "settings": { "metadataUrlParams": { "sap-documentation": "heading" } } } }, … } }
Before SAPUI5 release 1.30, all models were defined and instantiated in the component's init method. We recommend removing all manual model creation code and switching to the automatic model instantiation instead. The "device model" however is still a local model that has to be instantiated manually.
The following models are created as local JSON models in the app and can be referenced by its model name where needed:
device
The device model provides an easy access to the SAPUI5/OpenUI5 device API and is used to configure certain view settings according to the user’s device.
FLP
The FLP model is a helper module to configure SAP Fiori launchpad (FLP) integration and is used to control the sharing options of the app.
worklistView
A local view model for the worklist view that stored configuration options that are bound to controls in the view.
objectView
A local view model for the object view that stored configuration options that are bound to controls in the view.