‎2018 Nov 08 8:59 PM
Hello,
i have a question and i hope somebody can help me...
I create a Odata Mock Service with an metadata.xml file.
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="S1">
<EntityType Name="Aktion">
<Key>
<PropertyRef Name="AktID"/>
</Key>
<Property Name="AktID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ArtId" Type="Edm.Int32" Nullable="false"/>
<Property Name="Matnr" Type="Edm.String" Nullable="false"/>
<Property Name="Bezeichnung" Type="Edm.String" Nullable="true"/>
<NavigationProperty Name="Aktion_Aktionsdetail" Relationship="S1.FK_Aktion_Aktiondetail" ToRole="Aktiondetail" FromRole="Aktion"/>
</EntityType>
<EntityContainer Name="AktionEntities" m:IsDefaultEntityContainer="true" xmlns:p7="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet EntityType="S1.Aktion" Name="Aktions"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
I can work with the Data in the view but i dont know, how to access the data in a controler.
I create a Model with the following name "Aktions".
var oModel2 = this.getOwnerComponent().getModel("Aktions");
Now how can i get the data from my model ?
Thank you....
Dominic
‎2018 Nov 09 10:58 AM
Hi Dominic,
you need to use 'read' method of odatamodel to access the data.
oModel2.read(.... ); // Pass path, success handler and error handler functions
https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataModel/methods/read
BR,
Mahesh
‎2018 Nov 09 10:58 AM
Hi Dominic,
you need to use 'read' method of odatamodel to access the data.
oModel2.read(.... ); // Pass path, success handler and error handler functions
https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataModel/methods/read
BR,
Mahesh
‎2018 Nov 09 7:01 PM
‎2018 Nov 10 8:09 AM