Skip to Content
0
Former Member
Nov 15, 2013 at 12:11 AM

sap.m.FlexBox Not displaying

23 Views

Hi all,

Can't seem to figure out why my mobile app is not displaying the details of a FlexBox.

Index.html looks as follows:

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<script src="resources/sap-ui-core.js"

id="sap-ui-bootstrap"

data-sap-ui-libs="sap.m"

data-sap-ui-xx-fakeOS="android"

data-sap-ui-theme="sap_mvi">

</script>

<!-- only load the mobile lib "sap.m" and the "sap_mvi" theme -->

<script>

sap.ui.localResources("zmymobileapp");

var app = new sap.m.App({initialPage:"idMenu"});

var pageMenu = sap.ui.view({id:"idMenu", viewName:"zmymobileapp.Menu", type:sap.ui.core.mvc.ViewType.JS});

app.addPage(pageMenu);

var pageMyOrders = sap.ui.view({id:"idMyOrders", viewName:"zmymobileapp.MyOrders", type:sap.ui.core.mvc.ViewType.JS});

app.addPage(pageMyOrders);

var pageMyCustomers = sap.ui.view({id:"idMyCustomers", viewName:"zmymobileapp.MyCustomers", type:sap.ui.core.mvc.ViewType.JS});

app.addPage(pageMyCustomers);

app.placeAt("content");

</script>

</head>

<body class="sapUiBody" role="application">

<div id="content"></div>

</body>

</html>

Want to have a simply menu with two (button) items stored in a FlexBox so the Menu Page and corresponding view looks as follows:

sap.ui.jsview("zmymobileapp.Menu", {

/** Specifies the Controller belonging to this View.

* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.

* @memberOf zmymobileapp.Menu

*/

getControllerName : function() {

return "zmymobileapp.Menu";

},

/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.

* Since the Controller is given to this method, its event handlers can be attached right away.

* @memberOf zmymobileapp.Menu

*/

createContent : function(oController) {

oPage = new sap.m.Page({

title: "Menu"

});

var oMyFlexbox = new sap.m.FlexBox("fB");

oMyFlexbox.setVisible(true);

oMyFlexbox.addItem( new sap.m.Button({text: "Button 1"}) );

oMyFlexbox.addItem( new sap.m.Button({text: "Button 2"}) );

oMyFlexbox.setJustifyContent('Start');

oMyFlexbox.setAlignItems('Start');

oPage.addContent(oMyFlexbox);

return oPage;

}

});

I run the page locally in Chrome with the URL generated in Eclipse. I simply don't get any data on the page.

Thanks,

John