Reputation: 2030
I'm trying to binding oData to my List using mock server.
My metadata.xml is
<edmx:Edmx
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
Version="1.0">
<edmx:DataServices m:DataServiceVersion="2.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="GWSAMPLE_BASIC" xml:lang="en">
<EntityType Name="Equipment" BaseType="GWSAMPLE_BASIC.EquipmentBO">
</EntityType>
<EntityContainer Name="DefaultContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="EquipmentSet" EntityType="GWSAMPLE_BASIC.Equipment"/>
</EntityContainer>
<EntityType Name="EquipmentBO" BaseType="GWSAMPLE_BASIC.BaseEntityBO">
<Property Name="code" Type="Edm.String" Nullable="true"></Property>
</EntityType>
<EntityType Name="BaseEntityBO" Abstract="true">
<Key>
<PropertyRef Name="id"></PropertyRef>
</Key>
<Property Name="id" Type="Edm.String"/>
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Equipment.json:
[
{
"id": "1"
},
{
"id": "2"
},
{
"id": "3"
}
]
But it appear like this:
When I add Key
:
<EntityType Name="Equipment" BaseType="GWSAMPLE_BASIC.EquipmentBO">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.String"/>
</EntityType>
It works fine:
Also, I found createKey
will also produce an error:
ODataModel-dbg.js:2005 Uncaught TypeError: Cannot read property 'propertyRef' of undefined
this.getModel().createKey("EquipmentSet", {
id : "111"
});
So my question is, can I fix this without changing my oData metadata? Key is already defined in BaseEntityBO
.
Upvotes: 1
Views: 411
Reputation: 2030
This question is a duplicate of openui5 issue #951.
Unfortunately datajs, the OData library we are using in SAPUI5, does not support derived entity types. As it is a rarely used feature, there currently are no plans to support this.
It seems this problem can only be solved from backend service.
Upvotes: 1