<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />
<!-- Change the version in the bootstrap from 1.42.1 back to 1.42.0 to see that the regression
was introduced with 1.42.1 -->
<script src="https://openui5.hana.ondemand.com/1.42.0/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-debug="true" data-sap-ui-libs="sap.m" data-sap-ui-resourceroots='{"view": "./"}' data-sap-ui-theme="sap_bluecrystal" data-sap-ui-xx-bindingSyntax="complex">
</script>
<script>
// Best practice would be to set this stuff up in an Component.js
// but let's not over-complicate stuff for demonstration purposes
// http://scn.sap.com/community/developer-center/front-end/blog/2014/12/10/sap-ui5-with-local-json-model
sap.ui.localResources("view");
var app = new sap.m.App({
initialPage: "idMain"
});
var page = sap.ui.view({
id: "idMain",
viewName: "view.Main",
type: sap.ui.core.mvc.ViewType.XML
});
app.addPage(page);
app.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
<mvc:View
controllerName="view.Main"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:layout="sap.ui.layout"
xmlns="sap.m">
<Page id="Page1"
title="Test">
<content>
<layout:VerticalLayout width="100%">
<List
showSeparators="Inner"
items="{/feed}">
<FeedListItem
maxCharacters="2000"
sender="Sender"
icon="sap-icon://activate"
info="This is just a demo..."
text="{text}" />
</List>
</layout:VerticalLayout>
</content>
</Page>
</mvc:View>
jQuery.sap.require("sap/ui/model/json/JSONModel");
sap.ui.controller("view.Main", {
// We don't need any controller code in our simple example
// but I left the code here for MVC-demonstration purposes
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf view.Main
*/
onInit: function () {
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({feed: [
{
text: "This text contains several lines:\nLine1\nLine2\nLine3\n\nand so on... "
},
{
text: "This text only contains one line :-)"
},
{
text: "Finally this text contains several lines again:\nLine1\nLine2\nLine3\n\nand so on... "
}
]});
this.getView().setModel(oModel);
},
/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf view.Main
*/
// onBeforeRendering: function() {
//
// },
/**
* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
* This hook is the same one that SAPUI5 controls get after being rendered.
* @memberOf view.Main
*/
// onAfterRendering: function() {
//
// },
/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
* @memberOf view.Main
*/
// onExit: function() {
//
// }
});