on 10-21-2015 4:49 PM
Thank you all for great help!
After I initialized JSONModel with this coding, it was defined.
var rootPath = jQuery.sap.getModulePath("ui5bp");
var oModel = new JSONModel(jQuery.sap.getModulePath("ui5bp", "/model/menu.json"));
this.getView().setModel(oModel);
I thought the JSONModel is automatically initialized with the entries inside of the manifest(ab Version 1.30) and I don't need the whole syntax.
Unfortunately I didn't find a sample for the new syntax (inside of manifest), if I want to load a local json file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could it have something to do with the manifest.json file?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, source code you have posted is working as a charm - see demo here - http://plnkr.co/edit/uc9kCHEHMtRwcTcVTuCm?p=preview
if you remove it from line 5 and line 3 and use full path like
var oJSONModel = new sap.ui.model.json.JSONModel();
does it work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sap.ui.define([
'jquery.sap.global',
'./Formatter',
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel'
], function(jQuery, Formatter, Controller, JSONModel) {
"use strict";
var TableController = Controller.extend("sap.m.sample.Table.Table", {
onInit: function () {
// set explored app's demo model on this sample
var oModel = new JSONModel(jQuery.sap.getModulePath("sap.ui.demo.mock", "/products.json"));
this.getView().setModel(oModel);
}
});
return TableController;
});
same as you have....hm..
Can you post the code where you're trying to use the JSONModel ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel",
"sap/ui/Device"
], function(UIComponent, JSONModel, Device) {
"use strict";
return UIComponent.extend("ui5bp.Component", {
metadata: {
manifest: "json"
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* @public
* @override
*/
init: function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
}
});
});
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>UI5 Boilerplate Fiori</title>
<!-- UI5 Bootstrap with OpenUI5 -->
<script
id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m,sap.ui.commons,sap.ui.table,sap.ui.ux3"
data-sap-ui-bindingSyntax="complex"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async"
data-sap-ui-resourceroots='{
"ui5bp": "./"
}'>
</script>
<script>
sap.ui.getCore().attachInit(function () {
new sap.m.Shell({
app: new sap.ui.core.ComponentContainer({
name: "ui5bp",
height: "100%"
})
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.