<!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_belize"
data-sap-ui-async="true"
data-sap-ui-modules="sap/ui/core/ComponentSupport"
data-sap-ui-compatversion="edge"
data-sap-ui-resourceroots='{"demo": "./"}'
data-sap-ui-xx-componentpreload="off"
data-sap-ui-xx-waitfortheme="init"
></script>
</head>
<body id="content" class="sapUiBody">
<div
data-sap-ui-component
data-id="rootComponentContainer"
data-name="demo"
data-height="100%"
data-settings='{"id": "rootComponent"}'
style="height: 100%;"
></div>
</body>
</html>
{
"_version": "1.10.0",
"start_url": "index.html",
"sap.app": {
"id": "demo",
"type": "application",
"title": "foo",
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {
"odataDemo": {
"uri": "https://cors-anywhere.herokuapp.com/https://services.odata.org/V2/(S(stackoverflow43661554))/OData/OData.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
}
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": [
"sap_belize",
"sap_belize_plus",
"sap_belize_hcw",
"sap_belize_hcb",
"sap_fiori_3",
"sap_fiori_3_dark",
"sap_fiori_3_hcb",
"sap_fiori_3_hcw"
]
},
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.74.0",
"libs": {
"sap.m": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"odataModel": {
"dataSource": "odataDemo",
"settings": {
"defaultBindingMode": "TwoWay",
"tokenHandling": false,
"preliminaryContext": true,
"canonicalRequests": true
},
"preload": true
}
},
"rootView": {
"viewName": "demo.view.Home",
"type": "XML",
"async": true
}
}
}
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("demo.Component", {
metadata: {
manifest: "json"
},
});
});
<mvc:View controllerName="demo.controller.Home"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
displayBlock="true"
height="100%"
>
<Page title="Products"
binding="{
path: 'odataModel>/Categories(1)',
events: {
dataRequested: '.onDataRequested',
change: '.onChange',
dataReceived: '.onDataReceived'
}
}"
>
<List growing="true"
items="{
path: 'odataModel>Products',
templateShareable: false
}"
mode="Delete"
delete=".onDelete(${$parameters>/listItem})"
>
<StandardListItem title="{odataModel>Name}" />
</List>
</Page>
</mvc:View>
sap.ui.define([
"sap/ui/core/mvc/Controller",
], function(Controller) {
"use strict";
return Controller.extend("demo.controller.Home", {
onDataRequested: function (event) {
debugger;
},
onChange: function (event) {
debugger;
},
onDataReceived: function (event) {
debugger;
},
onDelete: function(itemToDelete) {
const entryPath = itemToDelete.getBindingContext("odataModel").getPath();
this.getOwnerComponent().getModel("odataModel").remove(entryPath);
},
});
});
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
<Schema Namespace="ODataDemo" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm">
<EntityType Name="Product">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="false" />
<Property Name="Description" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="false" />
<Property Name="ReleaseDate" Type="Edm.DateTime" Nullable="false" />
<Property Name="DiscontinuedDate" Type="Edm.DateTime" Nullable="true" />
<Property Name="Rating" Type="Edm.Int32" Nullable="false" />
<Property Name="Price" Type="Edm.Decimal" Nullable="false" />
<NavigationProperty Name="Category" Relationship="ODataDemo.Product_Category_Category_Products" FromRole="Product_Category" ToRole="Category_Products" />
<NavigationProperty Name="Supplier" Relationship="ODataDemo.Product_Supplier_Supplier_Products" FromRole="Product_Supplier" ToRole="Supplier_Products" />
</EntityType>
<EntityType Name="Category">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<NavigationProperty Name="Products" Relationship="ODataDemo.Product_Category_Category_Products" FromRole="Category_Products" ToRole="Product_Category" />
</EntityType>
<EntityType Name="Supplier">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Address" Type="ODataDemo.Address" Nullable="false" />
<Property Name="Concurrency" Type="Edm.Int32" Nullable="false" ConcurrencyMode="Fixed" />
<NavigationProperty Name="Products" Relationship="ODataDemo.Product_Supplier_Supplier_Products" FromRole="Supplier_Products" ToRole="Product_Supplier" />
</EntityType>
<ComplexType Name="Address">
<Property Name="Street" Type="Edm.String" Nullable="true" />
<Property Name="City" Type="Edm.String" Nullable="true" />
<Property Name="State" Type="Edm.String" Nullable="true" />
<Property Name="ZipCode" Type="Edm.String" Nullable="true" />
<Property Name="Country" Type="Edm.String" Nullable="true" />
</ComplexType>
<Association Name="Product_Category_Category_Products">
<End Role="Product_Category" Type="ODataDemo.Product" Multiplicity="*" />
<End Role="Category_Products" Type="ODataDemo.Category" Multiplicity="0..1" />
</Association>
<Association Name="Product_Supplier_Supplier_Products">
<End Role="Product_Supplier" Type="ODataDemo.Product" Multiplicity="*" />
<End Role="Supplier_Products" Type="ODataDemo.Supplier" Multiplicity="0..1" />
</Association>
<EntityContainer Name="DemoService" m:IsDefaultEntityContainer="true">
<EntitySet Name="Products" EntityType="ODataDemo.Product" />
<EntitySet Name="Categories" EntityType="ODataDemo.Category" />
<EntitySet Name="Suppliers" EntityType="ODataDemo.Supplier" />
<AssociationSet Name="Products_Category_Categories" Association="ODataDemo.Product_Category_Category_Products">
<End Role="Product_Category" EntitySet="Products" />
<End Role="Category_Products" EntitySet="Categories" />
</AssociationSet>
<AssociationSet Name="Products_Supplier_Suppliers" Association="ODataDemo.Product_Supplier_Supplier_Products">
<End Role="Product_Supplier" EntitySet="Products" />
<End Role="Supplier_Products" EntitySet="Suppliers" />
</AssociationSet>
<FunctionImport Name="GetProductsByRating" EntitySet="Products" ReturnType="Collection(ODataDemo.Product)" m:HttpMethod="GET">
<Parameter Name="rating" Type="Edm.Int32" Mode="In" />
</FunctionImport>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>