Skip to content

Instantly share code, notes, and snippets.

@ricma
Last active August 29, 2015 14:04
Show Gist options
  • Save ricma/a4b90fee335552139a00 to your computer and use it in GitHub Desktop.
Save ricma/a4b90fee335552139a00 to your computer and use it in GitHub Desktop.
SAPUI5 Rendering problem: sap.m.Table inside sap.m.Page (see also this question: http://scn.sap.com/thread/3595325)
<!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="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m,sap.me,sap.ui.ux3"
data-sap-ui-theme="sap_bluecrystal"
type="text/javascript">
</script>
<script type="text/javascript">
var oModel = new sap.ui.model.json.JSONModel({
data: [ { name: "A" }, { name: "B" } ]});
var oTable = new sap.m.Table({
mode: sap.m.ListMode.SingleSelectMaster,
columns: [
new sap.m.Column({
header: new sap.m.Label({
text: "Description"})})],
items: {
path: "data",
template: new sap.m.ColumnListItem({
cells: [
new sap.m.Text({ text: "{name}" })]})}});
var oPage = new sap.m.Page({content: [ oTable ]}).
bindElement("/").
setModel(oModel);
// select true or false here to get different variants
var oApp;
sap.ui.core.UIComponent.extend("myUIComponent", {
metadata: {
properties: {
tooltip: "The Tip!" } },
renderer: "sap.ui.core.UIComponentRenderer"
} );
if (false) {
// This is working but deprecated ... :(
oApp = new sap.m.App({
pages: [oPage],
initialPage: oPage.getId()});
new sap.m.Shell({ app : oApp }).placeAt("content");
} else {
// This is not working ... :(
oApp = new sap.ui.core.ComponentContainer({
component: new myUIComponent({
content: [oTable]})});
new sap.ui.ux3.Shell ({ app : oApp }).placeAt("content");
}
</script>
</head>
<body class="sapUiBody">
<div id="content"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment