<!DOCTYPE html>
<html style="height: 100%;">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Demo</title>
<script id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-async="true"
data-sap-ui-modules="sap/ui/thirdparty/sinon,sap/ui/thirdparty/datajs,demo/localService/mockserver"
data-sap-ui-oninit="module:demo/init"
data-sap-ui-compatversion="edge"
data-sap-ui-excludejquerycompat="true"
data-sap-ui-resourceroots='{ "demo": "./" }'
data-sap-ui-xx-waitfortheme="init"
></script>
</head>
<body id="content" class="sapUiBody">
<div style="height: 100%;"
data-sap-ui-component
data-id="rootComponentContainer"
data-name="demo"
data-height="100%"
data-settings='{ "id": "rootComponent" }'
></div>
</body>
</html>
sap.ui.define([
"sap/ui/core/UIComponent",
], function(UIComponent) {
"use strict";
return UIComponent.extend("demo.Component", {
metadata: {
manifest: "json",
interfaces: [
"sap.ui.core.IAsyncContentCreation"
]
},
});
});
{
"_version": "1.33.0",
"start_url": "index.html",
"sap.app": {
"id": "demo",
"type": "application",
"title": "Demo",
"description": "Sample Code",
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {
"MyNodes": {
"uri": "/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
}
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"handleValidation": true,
"dependencies": {
"minUI5Version": "1.86.3",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.table": {}
}
},
"models": {
"": {
"dataSource": "MyNodes",
"preload": true,
"settings": {
"defaultBindingMode": "TwoWay"
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"rootView": {
"viewName": "demo.view.Root",
"id": "rootView",
"type": "XML",
"async": true,
"height": "100%",
"displayBlock": true
}
}
}
<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
core:require="{
ODataDecimalType: 'sap/ui/model/odata/type/Decimal'
}"
>
<App xmlns="sap.m" autoFocus="false">
<Page showHeader="false" class="sapUiResponsiveContentPadding">
<table:Table xmlns:table="sap.ui.table" rows="{/OrderSet}">
<table:Column>
<table:template>
<Input value="{
path: 'MyNumber',
type: 'ODataDecimalType',
formatOptions: {},
constraints: {
nullable: false,
minimum: '0.01',
maximum: '9',
scale: 2
}
}"/>
</table:template>
</table:Column>
</table:Table>
<Panel headerText="Values in ODataModel" content="{/OrderSet}">
<ObjectAttribute text="{MyNumber}"/>
</Panel>
</Page>
</App>
</mvc:View>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="Demo" xml:lang="en" sap:schema-version="1">
<EntityType Name="Order">
<Key>
<PropertyRef Name="OrderID" />
</Key>
<Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
<Property Name="MyString" Type="Edm.String" Nullable="true" />
<Property Name="MyNumber" Type="Edm.Decimal" Nullable="false" />
</EntityType>
<EntityContainer Name="DemoEntities" m:IsDefaultEntityContainer="true">
<EntitySet Name="OrderSet" EntityType="Demo.Order" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
sap.ui.define([
"sap/ui/core/util/MockServer",
], function(MockServer) {
"use strict";
return {
init: function() {
MockServer.config({
autoRespond: true,
autoRespondAfter: 0,
});
const mockServer = new MockServer({
rootUri: "/",
recordRequests: false,
});
const pathPrefix = sap.ui.require.toUrl("demo/localService");
mockServer.simulate(`${pathPrefix}/metadata.xml`, {
sMockdataBaseUrl: `${pathPrefix}/mockdata`
});
mockServer.start();
}
};
});
[
{
"OrderID": 1,
"MyString": "Prop1",
"MyNumber": "1.234"
},
{
"OrderID": 2,
"MyString": "Prop2",
"MyNumber": "5.678"
},
{
"OrderID": 3,
"MyString": "Prop3",
"MyNumber": "9.000"
}
]
sap.ui.require([
"demo/localService/mockserver",
], function(mockserver) {
"use strict";
mockserver.init();
sap.ui.require([ "sap/ui/core/ComponentSupport" ]);
});