Hi Indrajit,
Thanks.
I have maitained the folder structure as above and I have given some test sample content in the view and in the mainifest.json I have maintained the root view. But still I am not able to see the contents in the view.
manifest.json
{
"_version": "0.0.1",
"sap.app":
{
"name": "com.test",
"version": "0.0.1",
"description": "Sample application to understand component.js/json",
"dependencies": {
}
},
"sap.ui5": {
"_version": "1.1.0",
"rootView": "com.test.component.webapp",
"dependencies": {
"minUI5Version": "1.30",
"libs": {
"sap.m": {}
}
}
}
index.html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-preload="async"
data-sap-ui-resourceroots='{
"com.test": "./"
}' >
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
<script>
/* sap.ui.localResources("component");
var app = new sap.m.App({initialPage:"idwebapp1"});
var page = sap.ui.view({id:"idwebapp1", viewName:"component.webapp", type:sap.ui.core.mvc.ViewType.XML});
app.addPage(page);
app.placeAt("content");*/
sap.ui.getCore().attachInit(function () {
new sap.ui.core.ComponentContainer({
name : "com.test"
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
Component.js
jQuery.sap.declare("com.test.Component");
sap.ui.core.UIComponent.extend("com.test.Component",
{
metadata : {
manifest: "json"
},
init : function ()
{
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
var oData = [
{lastName: "Richard", name: "Parker"},
{lastName: "Bruce", name: "Wayne"}
];
var oModel = new sap.ui.model.json.JSONModel(oData);
this.setModel(oModel);
var i18nModel = new sap.ui.model.resource.ResourceModel({
bundleUrl : "i18n/i18n.properties"
});
this.setModel(i18nModel, "i18n");
}
}
);
Regards,
Madhav