Created
July 14, 2016 10:43
-
-
Save StErMi/cda9147c78c725658f114f4202b7047b to your computer and use it in GitHub Desktop.
Example of loading local JSON data from the Component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sap.ui.define([ | |
"sap/ui/core/UIComponent", | |
"sap/ui/model/json/JSONModel" | |
], function(UIComponent, JSONModel) { | |
"use strict"; | |
return UIComponent.extend("com.openui5.example.Component", { | |
metadata: { | |
manifest: "json" | |
}, | |
init: function() { | |
// call the base component's init function | |
UIComponent.prototype.init.apply(this, arguments); | |
//Create the model and load data from the local JSON file | |
var oModel = new JSONModel("./model/init_data.json"); | |
oModel.setDefaultBindingMode("OneWay"); | |
// set the device model | |
this.setModel(oModel, "init_data"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment