Skip to Content
0
Former Member
Apr 03, 2014 at 12:46 PM

No Content in Page (SAPUI5 Mobile)

138 Views

Hi..

i have write an little Demo-App. The codings are from different Tutorials but I can not see my Button in the DetailView.

Here is the code:

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">

</script>

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

<script>

sap.ui.localResources("mapdemosapui5");

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

var page = sap.ui.view({id:"idApp1", viewName:"mapdemosapui5.App", 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>

App.view.xml:

<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"

controllerName="mapdemosapui5.App" xmlns:html="http://www.w3.org/1999/xhtml">

<Page title="Title" height="100%">

<mvc:JSView id="detailPageView" viewName="mapdemosapui5.DetailView"></mvc:JSView>

<!-- <mvc:XMLView id="detailPageView" viewName="mapdemosapui5.DetailView"></mvc:XMLView> -->

</Page>

</core:View>

App.controller.js:

nothing changed

DetailView.view.js:

sap.ui.jsview("mapdemosapui5.DetailView", {

getControllerName : function() {

return "mapdemosapui5.DetailView";

},

createContent : function(oController) {

//

// create some dummy JSON data

var data = {

names: [

{firstName: "Peter", lastName: "Mueller"},

{firstName: "Petra", lastName: "Maier"},

{firstName: "Thomas", lastName: "Smith"},

{firstName: "John", lastName: "Williams"},

{firstName: "Maria", lastName: "Jones"}

]

};

// create a Model with this data

var model = new sap.ui.model.json.JSONModel();

model.setData(data);

// create the UI

// create a List control

var list = new sap.m.List({

headerText:"Names"

});

// bind the List items to the data collection

list.bindItems({

path : "/names",

sorter : new sap.ui.model.Sorter("lastName"),

template : new sap.m.StandardListItem({

title: "{lastName}",

description: "{firstName}"

})

});

// set the model to the List, so it knows which data to use

list.setModel(model);

var page = new sap.m.Page({

title: "List Page",

content : [

new sap.m.Button({text: "Dummy Button"}),

list]

});

return page;

}

});

DetailViewController.js

Nothing changed

Can somebody explain, why I can not see any content of the List? No Button and no List, only the titles of the pages.

Thanks a lot.