Skip to Content
avatar image
Former Member

WebIDE - Mock Data - nothing is showing on the view after binding


Another simple application to use mock data and bind it to a view. Nothing is showing on the view when run.


1. create project template SAP UI app

2. create oData Model file - Customers.edmx created

<edmx:Edmx Version="1.0" xmlns:edmx="" xmlns:sap="">
	<edmx:DataServices xmlns:m="" m:DataServiceVersion="2.0">
		<Schema xmlns="" Namespace="ns">
			<EntityType Name="Customer">
					<PropertyRef Name="CustomerId"/>
				<Property Name="CustomerId" Nullable="false" Type="Edm.String"/>
				<Property Name="Name" Type="Edm.String"/>
				<Property Name="SalesOrg" Type="Edm.String"/>
			<EntityContainer Name="default" m:IsDefaultEntityContainer="true">
				<EntitySet EntityType="ns.Customer" Name="Customers"/>
				<EntitySet EntityType="ns.Customer" Name="Dummy"/>

3. edit mock data - Customers.json created

4. Check manifest.json is dataSources is pointing to "localUri": "localService/metadata.xml"

		"dataSources": {
			"ns": {
				"uri": "",
				"type": "OData",
				"settings": {
					"odataVersion": "2.0",
					"localUri": "localService/metadata.xml"

5. Check project settings is pointing to localService/metadata.xml

6. In view - data set = Customers

6.1 add sap.ui.layout.form

6.2 set sap.m.input binding to {name}

7. In component.js -> metadata manifest + config; set main model

], function(UIComponent, Device, models) {
	"use strict";

	return UIComponent.extend("nsztest02.Component", {

		metadata: {
			manifest: "json"

		 * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
		 * @public
		 * @override
		init: function() {
			// call the base component's init function
			UIComponent.prototype.init.apply(this, arguments);

			// set the device model
			this.setModel(models.createDeviceModel(), "device");
			// set main model
				var mConfig = this.getMetadata().getConfig();
				var sServiceUrl = mConfig.serviceConfig.serviceUrl;
				var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, {
					json: true,
					loadMetadataAsync: true
				oModel.attachMetadataFailed(function(){}, this);



8. in model.js -

], function(JSONModel, Device) {
	"use strict";

	return {

		createDeviceModel: function() {
			var oModel = new JSONModel(Device);
			return oModel;


Run Index.html

Please assist. Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers