Skip to Content
0

Problem with custom SAP UI5 app with XML view.

Oct 28, 2016 at 02:49 AM

85

avatar image

I am using SAP UI5 template in WEB IDE (Trail version). I dont have any compile time errors but not getting any errors. Can some one please let me know what I am missing. Below is the code. Thanks.

*************

index.html

*************

<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta charset="UTF-8">

		<title>Practise_XMLview</title>


		<script id="sap-ui-bootstrap"
			src="../../resources/sap-ui-core.js"
			data-sap-ui-libs="sap.m"
			data-sap-ui-theme="sap_bluecrystal"
			data-sap-ui-compatVersion="edge"
		data-sap-ui-resourceroots='{"Practise_XMLview": ""}'>
		</script>

		<link rel="stylesheet" type="text/css" href="css/style.css">
		<script>
			sap.ui.getCore().attachInit(function() {
				new sap.m.Shell({
				app: new sap.ui.core.ComponentContainer({
						height : "100%",
						name : "Practise_XMLview"
					})
				}).placeAt("content");
			});
		</script>
	</head>


	<body class="sapUiBody" id="content">
	</body>


</html>

***************************************************
Controller start
***************************************************

sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function(Controller) {
	"use strict";
	
	var oModel = new sap.ui.model.xml.xmlModel();
	oModel.loadxml("model/school.xml");

 application life-cycle.
	sap.ui.getCore().setModel(oModel);
	return Controller.extend("Practise_XMLview.controller.View1", {
	});
});

********************
View Start
********************

<mvc:View controllerName="Practise_XMLview.controller.View1" 
			xmlns:html="http://www.w3.org/1999/xhtml" 
			xmlns:mvc="sap.ui.core.mvc"
			xmlns="sap.m"
			xmlns:sap.ui.core="sap.ui.core"
			xmlns:sap.ui.layout="sap.ui.layout">
	<App>
		<pages>
			<Page title="{i18n>title}">
				<content>
				<List	headerText = "School Details"
						items = "{/details}">
						
	<StandardListItem	title = "{class}"
											type = "Active"
											press = "handleItemSelect">
	</StandardListItem>
					</List>
				</content>
			</Page>
		</pages>
	</App>
</mvc:View>

****************

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jun Wu Oct 28, 2016 at 03:08 AM
0

what is your problem????????????????

app:newsap.ui.core.ComponentContainer({
						height :"100%",name:"Practise_XMLview"}) 
Practise_XMLview needs to be component if you want to put it here
Share
10 |10000 characters needed characters left characters exceeded
Venkata Sunil Naidu Chennam Oct 28, 2016 at 04:23 PM
0

I want to show in the view the data which is there in the XML file. I dont see any compile time errors but I when I run the index.html file I get blank screen.

Here the XML file is basically my model.

<?xml version="1.0" encoding="UTF-8"?>


<school>
	<details id="det">
		<class>Grade 1</class>
		<class-teacher>Sameer</class-teacher>
		<students-count>32</students-count>
	</details>
</school>
Share
10 |10000 characters needed characters left characters exceeded
Venkata Sunil Naidu Chennam Oct 28, 2016 at 07:03 PM
0

What I feel is..nothing is working in my WEBIDE. Seems like I need to do some initial settings before I start running the application. Because, even below code which is only HTML code in index.html is not working. I just get blank screen when I right click on index.html and run.

<html>
    <h2>Hello world</h2>
</html>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta charset="utf-8">
	<title>SAPUI5 Data Binding Tutorial</title>
	<script
		id="sap-ui-bootstrap"
		src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
		data-sap-ui-theme="sap_bluecrystal"
		data-sap-ui-libs="sap.m"
		data-sap-ui-compatVersion="edge"
		data-sap-ui-preload="async"
		>
	</script>
	<script>
		// Attach an anonymous function to the SAPUI5 'init' event
		sap.ui.getCore().attachInit(function () {
		    // Create a JSON model from an object literal
			var oModel = new sap.ui.model.json.JSONModel({
				greetingText: "Hi, my name is Harry Hawk"
			});
			// Assign the model object to the SAPUI5 core
			sap.ui.getCore().setModel(oModel);


			// Display a text element whose text is derived
			// from the model object
			new sap.m.Text({text: "{/greetingText}"})
				.placeAt("content");
		});
	</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>


Share
10 |10000 characters needed characters left characters exceeded