<!DOCTYPE html>
<html style="height: 100%;">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Demo</title>
<!-- In production: use a specific UI5 version. Not the "latest" one -->
<script id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-async="true"
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-compatversion="edge"
data-sap-ui-excludejquerycompat="true"
data-sap-ui-resourceroots='{ "demo": "./" }'
data-sap-ui-xx-waitfortheme="init"
data-sap-ui-xx-componentpreload="off"
></script><!-- xx-componentpreload="off" only for previews to avoid 404 -->
</head>
<body id="content" class="sapUiBody">
<div style="height: 100%;"
data-sap-ui-component
data-id="rootComponentContainer"
data-name="demo"
data-height="100%"
data-settings='{ "id": "rootComponent" }'
></div>
</body>
</html>
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"sap/ui/core/ComponentSupport",//https://github.com/SAP/ui5-tooling/issues/381
], function(UIComponent, Device) {
"use strict";
return UIComponent.extend("demo.Component", {
metadata: {
interfaces: [
"sap.ui.core.IAsyncContentCreation"
],
manifest: "json",
},
init: function () {
UIComponent.prototype.init.apply(this, arguments);
this.setDensity().getRouter().initialize();
const aData = [];
for (let i = 1; i <= 100; i++) {
aData.push({ number: i });
}
this.getModel().setData(aData);
},
setDensity: function ({
styleClass = Device.system.desktop ? "sapUiSizeCompact" : "sapUiSizeCozy",
targetElement = document.body,
} = {}) {
targetElement.classList.add(styleClass);
return this;
},
});
});
{
"_version": "1.35.0",
"start_url": "index.html",
"sap.app": {
"id": "demo",
"type": "application",
"title": "App Title",
"description": "Sample Code",
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {}
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"handleValidation": true,
"dependencies": {
"minUI5Version": "1.92.1",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.f": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"resources": {
"css": [
],
"js": [ "(This section is deprecated!)" ]
},
"models": {
"": {
"type": "sap.ui.model.json.JSONModel"
}
},
"rootView": {
"viewName": "demo.view.App",
"id": "rootView",
"type": "XML",
"height": "100%"
},
"routing": {
"routes": {
"home": {
"pattern": "",
"target": "home"
},
"next": {
"pattern": "next",
"target": "next"
}
},
"targets": {
"home": {
"id": "homeView",
"name": "Home",
"viewLevel": 1
},
"next": {
"id": "nextView",
"viewName": "Next",
"viewLevel": 2
},
"notFound": {
"id": "notFoundView",
"name": "Home",
"transition": "slide",
"viewLevel": 98
}
},
"config": {
"async": true,
"type": "View",
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"path": "demo.view",
"controlId": "rootContainer",
"controlAggregation": "pages",
"transition": "slide",
"bypassed": {
"target": "notFound"
},
"homeRoute": "home"
}
}
}
}
<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns:f="sap.f"
xmlns="sap.m"
displayBlock="true"
>
<App autoFocus="false">
<Page enableScrolling="false">
<customHeader>
<f:ShellBar title="This bar is always visible">
<f:profile>
<Avatar src="sap-icon://sap-ui5" />
</f:profile>
</f:ShellBar>
</customHeader>
<NavContainer id="rootContainer" autoFocus="false">
<!-- will be added by the Router -->
</NavContainer>
</Page>
</App>
</mvc:View>
<mvc:View controllerName="demo.controller.Home"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
>
<Page
showHeader="true"
title="Home"
class="sapUiResponsivePadding--header sapUiResponsivePadding--content"
>
<List items="{/}" itemPress=".onItemPress">
<StandardListItem title="{number}" type="Navigation" />
</List>
</Page>
</mvc:View>
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<Page
title="Navigated View"
class="sapUiResponsivePadding--header sapUiResponsivePadding--content"
>
<Text text="Nav back" class="sapUiTinyMargin" />
</Page>
</mvc:View>
sap.ui.define([
"sap/ui/core/mvc/Controller",
], function(Controller) {
"use strict";
return Controller.extend("demo.controller.Home", {
onItemPress: function() {
this.getOwnerComponent().getRouter().navTo("next");
},
});
});