In the following example russelwhyte is the id, but how does the provider know to map it to the UserName property?
URL: http://services.odata.org/V4/TripPinServiceRW/People?$format=application/json;odata.metadata=full
Response:
{
#odata.context: "http://services.odata.org/V4/(S(ck3fzk3dze0kmzjcruxiz31i))/TripPinServiceRW/$metadata#People",
#odata.nextLink: "http://services.odata.org/V4/TripPinServiceRW/People?%24format=application%2fjson%3bodata.
metadata%3dfull&%24skiptoken=8",
value:
[
{
#odata.type: "#Microsoft.OData.SampleService.Models.TripPin.Person",
#odata.id: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')",
#odata.etag: "W/"08D17DBDFB9CCAAC"",
#odata.editLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')",
UserName: "russellwhyte",
FirstName: "Russell",
LastName: "Whyte",
...
Friends#odata.associationLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')/Friends/$ref",
Friends#odata.navigationLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')/Friends",
...
},
...
]
}
By overriding GetEntityByKey of the base class EntitySetController
Query the metadata document, you can get the model schema for the service, and in which you can find which properties are the keys/IDs.
For example:
GET: http://services.odata.org/V4/(S(ksn5grnrgbebt44osly5z2vr))/TripPinServiceRW/$metadata
<EntityType Name="Person" OpenType="true">
<Key>
<PropertyRef Name="UserName"/>
</Key>
<Property Name="UserName" Type="Edm.String" Nullable="false">
<Annotation Term="Org.OData.Core.V1.Permissions">
<EnumMember>Org.OData.Core.V1.Permission/Read</EnumMember>
</Annotation>
</Property>
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false"/>
<Property Name="Emails" Type="Collection(Edm.String)"/>
<Property Name="AddressInfo" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Location)"/>
<Property Name="Gender" Type="Microsoft.OData.SampleService.Models.TripPin.PersonGender"/>
<Property Name="Concurrency" Type="Edm.Int64" Nullable="false">
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
</Property>
<NavigationProperty Name="Friends" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Person)"/>
<NavigationProperty Name="Trips" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Trip)" ContainsTarget="true"/>
<NavigationProperty Name="Photo" Type="Microsoft.OData.SampleService.Models.TripPin.Photo"/>
</EntityType>
Related
I am trying to use SmartFilterBar as follows:
<VBox fitContainer="true">
<smartFilterBar:SmartFilterBar id="JobProfileOverviewFilter" entitySet="ProfileSet">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="Item"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
<smartFilterBar:layoutData>
<FlexItemData shrinkFactor="0"/>
</smartFilterBar:layoutData>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="JobProfileOverview" entitySet="ProfileSet" tableType="ResponsiveTable" useTablePersonalisation="true"
showRowCount="true" enableAutoBinding="true" smartFilterId="JobProfileOverviewFilter" header="Business profiles"
class="sapUiResponsiveContentPadding" app:useSmartToggle="true">
<smartTable:customToolbar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<OverflowToolbarButton icon="sap-icon://order-status" tooltip="Order status" text="Order status" press="onStatus"/>
</OverflowToolbar>
</smartTable:customToolbar>
<!-- layout data used to make the table growing but the filter bar fixed -->
<smartTable:layoutData>
<FlexItemData growFactor="1" baseSize="0%"/>
</smartTable:layoutData>
<Table mode="MultiSelect"></Table>
</smartTable:SmartTable>
</VBox>
The problem is, the filter does not appear on the screen.
the cutout from the metadata:
<EntityType Name="Profile" sap:content-version="1">
<Key>
<PropertyRef Name="ItemId"/>
</Key>
<Property Name="Item" Type="Edm.String" Nullable="false" MaxLength="300" sap:unicode="false" sap:label="Role" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Connector" Type="Edm.String" Nullable="false" MaxLength="32" sap:unicode="false" sap:label="System" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Descn" Type="Edm.String" Nullable="false" sap:unicode="false" sap:label="Description" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ValidFrom" Type="Edm.DateTime" Nullable="false" Precision="7" sap:unicode="false" sap:label="Valid From"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ValidTo" Type="Edm.DateTime" Nullable="false" Precision="7" sap:unicode="false" sap:label="Valid To" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Status" Type="Edm.String" Nullable="false" MaxLength="8" sap:unicode="false" sap:label="Expiration Status"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Selected" Type="Edm.String" Nullable="false" MaxLength="1" sap:unicode="false" sap:label="Boolean" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ItemId" Type="Edm.String" Nullable="false" MaxLength="50" sap:unicode="false" sap:label="Object ID" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ItemType" Type="Edm.String" Nullable="false" MaxLength="6" sap:unicode="false" sap:label="Item Type" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
</EntityType>
<EntitySet Name="ProfileSet" EntityType="YGAC_ACCESS_MANAGER_SRV.Profile" sap:creatable="false" sap:updatable="false" sap:deletable="false"
sap:pageable="false" sap:content-version="1"/></EntityContainer>
What am I doing wrong?
Update
I have enabled the filter now
But it does not appear in SmartFilter:
I have to enable it in the filter option:
Why the filter fields do not get shown as default?
Try to add other parameters, for example:
<smartFilterBar:ControlConfiguration
key="Item"
mandatory="auto"
preventInitialDataFetchInValueHelpDialog="false"
visibleInAdvancedArea="true"
controlType="auto"
displayBehaviour="idAndDescription"
label="Item"
index="1"></smartFilterBar:ControlConfiguration>
I am trying to call a Odata service (crequestSet) which will create an article in MDG system.
I need to pass few parameters from the ui5 input fields and some should be hard coded values.
I have created a request.json file under models folder:
{
"CR_MARA": {
"Matk": "",
"Mtart": "HAWA",
"Attyp": "01",
"Meins": "EA"
},
"CR_MAW1": {
"Wladg": "0001",
"Wbkla": "3100"
},
"CR_MARM": {
"Meinh": "EA",
"Umrez": "1",
"Umren": "1"
},
"CR_MAKT": {
"Spras": "EN",
"Maktg": "Art 101 A",
"Maktx": "Art 101 A"
},
"CR_STEU": {
"Aland": "DE",
"Tatyp": "TTX1",
"Taxkm": "0"
}
}
Now i am trying to call the service /createrequest by using the model.
Create ('EnitityEset',oData {Success:"",Failure:""}) of the odata model in sapui5.
For a simple JSON model like:
{
"store": "",
"merchCat": "",
}
i can simple do:
var oData = {
Store: oLocal.getProperty("/store"),
MerchCat: oLocal.getProperty("/merchCat")
}
and then call the create method:
oModel.create("/crequestSet", oData, {
success: this._fnSuccess.bind(this),
error: this._fnFailed.bind(this)
})
But how do i pass the complex json object:
{
"CR_MARA": {
"Matk": "",
"Mtart": "HAWA",
"Attyp": "01",
"Meins": "EA"
},
"CR_MAW1": {
"Wladg": "0001",
"Wbkla": "3100"
},}
to the oModel.Create ?
I tried to do var oData = JSONModel.Stringyfy() to convert into a string,but it's not working and giving a error while service call.
The metadata structure of the crequest service:
-<EntityType sap:content-version="1" Name="crequest">
-<Key>
<PropertyRef Name="Matnr"/>
</Key>
<Property Name="ReasonForRequest" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="60" Nullable="false" Type="Edm.String"/>
<Property Name="Matnr" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="40" Nullable="false" Type="Edm.String" sap:label="Material"/>
<Property Name="CrDescription" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="60" Nullable="false" Type="Edm.String"/>
<Property Name="CrequestType" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="8" Nullable="false" Type="Edm.String"/>
<Property Name="CrequestId" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="12" Nullable="false" Type="Edm.String"/>
<Property Name="Matkl" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="9" Nullable="false" Type="Edm.String"/>
<Property Name="RefMatnr" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="40" Nullable="false" Type="Edm.String" sap:label="Material"/>
<Property Name="Reason" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="2" Nullable="false" Type="Edm.String"/>
<Property Name="Message" sap:filterable="false" sap:sortable="false" sap:updatable="false" sap:creatable="false" sap:unicode="false" MaxLength="220" Nullable="false" Type="Edm.String" sap:label="Message Text"/>
<NavigationProperty Name="CR_ATTACHMASTER" ToRole="ToRole_CR_ATTACHMASTER" FromRole="FromRole_CR_ATTACHMASTER" Relationship="UGIOD02_RFM_SRV.CR_ATTACHMASTER"/>
<NavigationProperty Name="CR_UOM" ToRole="ToRole_CR_UOM" FromRole="FromRole_CR_UOM" Relationship="UGIOD02_RFM_SRV.CR_UOM"/>
<NavigationProperty Name="CR_MARA" ToRole="ToRole_CR_MARA" FromRole="FromRole_CR_MARA" Relationship="UGIOD02_RFM_SRV.CR_MARA"/>
<NavigationProperty Name="CR_MARC" ToRole="ToRole_CR_MARC" FromRole="FromRole_CR_MARC" Relationship="UGIOD02_RFM_SRV.CR_MARC"/>
<NavigationProperty Name="CR_MAKT" ToRole="ToRole_CR_MAKT" FromRole="FromRole_CR_MAKT" Relationship="UGIOD02_RFM_SRV.CR_MAKT"/>
<NavigationProperty Name="CR_MARD" ToRole="ToRole_CR_MARD" FromRole="FromRole_CR_MARD" Relationship="UGIOD02_RFM_SRV.CR_MARD"/>
<NavigationProperty Name="CR_MARM" ToRole="ToRole_CR_MARM" FromRole="FromRole_CR_MARM" Relationship="UGIOD02_RFM_SRV.CR_MARM"/>
<NavigationProperty Name="CR_MVKE" ToRole="ToRole_CR_MVKE" FromRole="FromRole_CR_MVKE" Relationship="UGIOD02_RFM_SRV.CR_MVKE"/>
<NavigationProperty Name="CR_MAW1" ToRole="ToRole_CR_MAW1" FromRole="FromRole_CR_MAW1" Relationship="UGIOD02_RFM_SRV.CR_MAW1"/>
<NavigationProperty Name="CR_STEU" ToRole="ToRole_CR_STEU" FromRole="FromRole_CR_STEU" Relationship="UGIOD02_RFM_SRV.CR_STEU"/>
<NavigationProperty Name="CR_SAUSPW" ToRole="ToRole_CR_SAUSPW" FromRole="FromRole_CR_SAUSPW" Relationship="UGIOD02_RFM_SRV.CR_SAUSPW"/>
<NavigationProperty Name="CR_SVARKY" ToRole="ToRole_CR_SVARKY" FromRole="FromRole_CR_SVARKY" Relationship="UGIOD02_RFM_SRV.CR_SVARKY"/>
<NavigationProperty Name="CR_PURCHINFO" ToRole="ToRole_CR_PURCHINFO" FromRole="FromRole_CR_PURCHINFO" Relationship="UGIOD02_RFM_SRV.CR_PURCHINFO"/>
<NavigationProperty Name="CR_WLK2" ToRole="ToRole_CR_WLK2" FromRole="FromRole_CR_WLK2" Relationship="UGIOD02_RFM_SRV.CR_WLK2"/>
<NavigationProperty Name="CR_BOM" ToRole="ToRole_CR_BOM" FromRole="FromRole_CR_BOM" Relationship="UGIOD02_RFM_SRV.CR_BOM"/>
<NavigationProperty Name="CR_MBEW" ToRole="ToRole_CR_MBEW" FromRole="FromRole_CR_MBEW" Relationship="UGIOD02_RFM_SRV.CR_MBEW"/>
<NavigationProperty Name="CR_CHARACP" ToRole="ToRole_CR_CHARACP" FromRole="FromRole_CR_CHARACP" Relationship="UGIOD02_RFM_SRV.CR_CHARACP"/>
<NavigationProperty Name="CR_MAMT" ToRole="ToRole_CR_MAMT" FromRole="FromRole_CR_MAMT" Relationship="UGIOD02_RFM_SRV.CR_MAMT"/>
<NavigationProperty Name="CR_CLASSGEN" ToRole="ToRole_cr_classgen" FromRole="FromRole_cr_classgen" Relationship="UGIOD02_RFM_SRV.cr_classgen"/>
<NavigationProperty Name="CR_MESSAGE" ToRole="ToRole_Messages" FromRole="FromRole_Messages" Relationship="UGIOD02_RFM_SRV.Messages"/>
<NavigationProperty Name="CR_CLASSASGN" ToRole="ToRole_Classasgen_As" FromRole="FromRole_Classasgen_As" Relationship="UGIOD02_RFM_SRV.Classasgen_As"/>
<NavigationProperty Name="CR_VALUATION" ToRole="ToRole_Valuation_As" FromRole="FromRole_Valuation_As" Relationship="UGIOD02_RFM_SRV.Valuation_As"/>
<NavigationProperty Name="CR_SEASON" ToRole="ToRole_Season_det" FromRole="FromRole_Season_det" Relationship="UGIOD02_RFM_SRV.Season_det"/>
</EntityType>
sap.ui.model.odata.v2.ODataModel, method created accepts three parameters, being the second (oDatain the API Reference) the deep object you need to pass.
var oData = {
ReasonForRequest: "X",
Matnr: "Y",
RefMatnr: "Z",
CR_MARA: {
Matk: "",
Mtart: "HAWA",
Attyp: "01",
Meins: "EA"
},
CR_MAW1: [
{
Wladg: "0001",
Wbkla: "3100"
}
]
}
oModel.create("/EntitySet", oData, { } );
Please note some important concepts:
CR_MARA and CR_MAW1 are your NavigationProperties in the metadata.
As you did only provice your service metadata partially, it's not
possible to know what are the properties for each entity. The
associations in your metadata (not available in the metadata)
contain information about cardinalitty.
So if CR_MARA has
cardinalitty 1..1 it should be a deep object inside oData whilst
CR_MAW1 has cardinalitty 1..* it should be a array of objects
inside oData.
Moreover, it's semantically wrong to name EntitySets with "operation specific" names, like "CreateEntitySet" or "DeleteEntitySet" as you can (and tipically will) implement many operations in the same entity like Query, Read and Create at the same time.
The oData model (I assume you use v2) takes care of the structure when you use oModel.createEntry() or oModel.create(). You can just put the whole object into the second properties argument. I forked a northwind example project northwind-sapui5 to create a working example.
I have EntitySet and would like to connect to SmartFilterBar and SmartTable. The EntitySet looks like:
<EntitySet Name="I_PMContactCardEmployee" EntityType="EAM_MALFUNCTION_MANAGE.I_PMContactCardEmployeeType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:searchable="true" sap:content-version="1"/>
The EntityType:
<EntityType Name="I_PMContactCardEmployeeType" sap:label="Mitarbeiter" sap:content-version="1">
<Key>
<PropertyRef Name="PersonnelNumber"/>
</Key>
<Property Name="PersonnelNumber" Type="Edm.String" Nullable="false" MaxLength="8" sap:display-format="NonNegative" sap:text="EmployeeFullName" sap:label="Personalnummer"/>
<Property Name="EmployeeFullName" Type="Edm.String" MaxLength="80" sap:label="Vollständiger Name" sap:filterable="false"/>
<Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="Vorname" sap:quickinfo="Vorname des Geschäftspartners (Person)"/>
<Property Name="FamilyName" Type="Edm.String" MaxLength="40" sap:label="Nachname" sap:quickinfo="Nachname des Geschäftspartners (Person)"/>
<Property Name="Job" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Stellenschlüssel" sap:quickinfo="Stelle" sap:filterable="false"/>
<Property Name="JobName" Type="Edm.String" MaxLength="25" sap:label="Stellenbezeichnung" sap:filterable="false"/>
<Property Name="CompanyCode" Type="Edm.String" MaxLength="4" sap:display-format="UpperCase" sap:text="CompanyCodeName" sap:label="Buchungskreis"/>
<Property Name="CompanyCodeName" Type="Edm.String" MaxLength="25" sap:label="Name der Firma" sap:quickinfo="Buchungskreis- oder Firmen-Bezeichnung" sap:filterable="false"/>
<Property Name="OrganizationalUnit" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Organisationseinheit"/>
<Property Name="OrganizationalUnitName" Type="Edm.String" MaxLength="25" sap:label="OrgEinheitenkurztext" sap:quickinfo="Organisationseinheitenkurztext" sap:filterable="false"/>
<Property Name="PhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
<Property Name="NormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
<Property Name="MobilePhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
<Property Name="MblNormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
<Property Name="DefaultEmailAddress" Type="Edm.String" MaxLength="241" sap:label="E-Mail-Adresse"/>
<Property Name="UserID" Type="Edm.String" MaxLength="12" sap:display-format="UpperCase" sap:label="Benutzer-ID" sap:filterable="false"/>
</EntityType>
and the view looks like:
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="malfunc>I_PMContactCardEmployee" persistencyKey="SmartFilterPKey">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="PersonnelNumber" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="smartTable_ResponsiveTable" smartFilterId="smartFilterBarr" tableType="ResponsiveTable" editable="false"
entitySet="malfunc>I_PMContactCardEmployee" useVariantManagement="true" useTablePersonalisation="true" header="Products" showRowCount="true"
useExportToExcel="false" enableAutoBinding="true" persistencyKey="SmartTablePKey"></smartTable:SmartTable>
the service is registered as:
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "example.com.smartemployee.i18n.i18n"
}
},
"malfunc": {
"uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "EAM_MALFUNCTION_MANAGE",
"preload": true
}
},
to get the data from the service, in the postman I called:
and get all of employees.
When I execute the application, SmartFilterBar and SmartTable is not working correctly.
It shows just an empty filterbar. What am I doing wrong?
As far as I know it is better to define the ODataModel as the default model.
"malfunc": {
"uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "EAM_MALFUNCTION_MANAGE",
"preload": true
}
Also, assuming that your EntitySet is called "I_PMContactCardEmployeeSet", you have to specifiy that EntitSet in the SmartFilterBar and SmartTable properties:
entitySet="I_PMContactCardEmployeeSet"
I'm developing a SAPUI5 application that's use a smart table component. But the oData provided does not send any annotations in the metatdata file. I'm starting selecting these fields from oData: PriorityName,OrderTypeType,OrderTypeName,Id,DateOpen,HourOpen,BrandName,EquipmentId,EquipmentNumber,SymptomName. But i want to show their as Priority Name, Order Type, Order Type Name, Id, Date Open, Hour Open, Brand Name, Equipment Id, Equipment Number and Symptom Name, respective, in table column header and p13ndialog.
I know that is changed by default in the sap:label property in Property Name tag under EntityType. But according the oData developer, they cant send it to me (He was using JPA and oLingo).
The code above is for my smarttable and the entity used in metadada.
<smartTable:SmartTable entitySet="CustomerOrders" id="tbOrders" tableType="Table" useExportToExcel="true" beforeExport="onBeforeExport"
header="Ordens de Manutenção" showRowCount="true" enableAutoBinding="true" beforeRebindTable="onBeforeRebindTable"
initiallyVisibleFields="PriorityName,OrderTypeType,OrderTypeName,Id,DateOpen,HourOpen,BrandName,EquipmentId,EquipmentNumber,SymptomName"
class="sapUiResponsiveContentPadding">
<smartTable:customToolbar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<OverflowToolbarButton icon="sap-icon://sort" text="Sort" press="onSort"/>
<OverflowToolbarButton icon="sap-icon://filter" text="Filter" press="onFilter"/>
</OverflowToolbar>
</smartTable:customToolbar>
<table:Table id="innerUi5Table" growing="true" selectionMode="None" visibleRowCountMode="Auto">
<table:rowSettingsTemplate>
<table:RowSettings highlight="{ path: 'PriorityName', formatter: '.formatter.OrderStatusFormatter' }"/>
</table:rowSettingsTemplate>
</table:Table>
</smartTable:SmartTable>
Metadata
<EntityType Name="CustomerOrder">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="BrandName" Type="Edm.String" Nullable="true" MaxLength="150"/>
<Property Name="City" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="ContactFirstname" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="ContactLastname" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="Country" Type="Edm.String" Nullable="true" MaxLength="2"/>
<Property Name="CustomerId" Type="Edm.Int64" Nullable="true"/>
<Property Name="DateOpen" Type="Edm.DateTime" Nullable="true"/>
<Property Name="EquipmentId" Type="Edm.String" Nullable="true" MaxLength="10"/>
<Property Name="EquipmentNumber" Type="Edm.String" Nullable="true" MaxLength="12"/>
<Property Name="EquipmentType" Type="Edm.String" Nullable="true" MaxLength="40"/>
<Property Name="FantasyName" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="HourOpen" Type="Edm.Time" Nullable="true"/>
<Property Name="Id" Type="Edm.Int64" Nullable="false"/>
<Property Name="Latitude" Type="Edm.String" Nullable="true" MaxLength="12"/>
<Property Name="Longitude" Type="Edm.String" Nullable="true" MaxLength="12"/>
<Property Name="ManufacturerSerialNumber" Type="Edm.String" Nullable="true" MaxLength="255"/>
<Property Name="Material" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="Neighborhood" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="Note" Type="Edm.String" Nullable="true" MaxLength="10"/>
<Property Name="Obs" Type="Edm.String" Nullable="true" MaxLength="150"/>
<Property Name="OrderTypeId" Type="Edm.String" Nullable="true" MaxLength="4"/>
<Property Name="OrderTypeName" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="OrderTypeType" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="OsImbera" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="Phone" Type="Edm.String" Nullable="true" MaxLength="11"/>
<Property Name="Plant" Type="Edm.String" Nullable="true" MaxLength="4"/>
<Property Name="PriorityId" Type="Edm.Int32" Nullable="true"/>
<Property Name="PriorityName" Type="Edm.String" Nullable="true" MaxLength="15"/>
<Property Name="State" Type="Edm.String" Nullable="true" MaxLength="2"/>
<Property Name="Status" Type="Edm.String" Nullable="true" MaxLength="1"/>
<Property Name="Street" Type="Edm.String" Nullable="true" MaxLength="150"/>
<Property Name="SymptomId" Type="Edm.Int64" Nullable="true"/>
<Property Name="SymptomName" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="SymptomObjTecnico" Type="Edm.String" Nullable="true" MaxLength="10"/>
<Property Name="SymptomSAP" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="TechnicalObjName" Type="Edm.String" Nullable="true" MaxLength="255"/>
<Property Name="WarrantyObs" Type="Edm.String" Nullable="true" MaxLength="45"/>
<Property Name="WorkCenter" Type="Edm.String" Nullable="true" MaxLength="8"/>
<Property Name="Zipcode" Type="Edm.String" Nullable="true" MaxLength="9"/>
</EntityType>
Redefine the rows/columns in your XML manually and bind your labels against i18n model, where you can define all the needed labels.
The bad thing about it - you cannot influence on the columns that potentially could be added via personalisation. Possible workaround - redefine ALL the columns. But in this case once the backend get changed, you have to adjust UI accordingly.
I'm following this Mockup Server tutorial for SAPUI5. But I'm not able to retrieve the data and set it to my model. Here's what I do:
I have slightly changed the data so, so two things have to be changed:
json data - Person.json:
{ "id":1,
"first_name":"Chris",
"last_name":"Johnston", "email":"cjohnston0#dailymotion.com", "gender":"Male", "ip_address":"119.220.205.173" }
emphasized text
``
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"/>
<edmx:DataServices m:DataServiceVersion="1.0"
m:MaxDataServiceVersion="3.0">
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Person">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property name="id" Type="Edm.Int16" Nullable="false" />
<Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="email" Type="Edm.String" Nullable="false"/>
<Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
<Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
</EntityType>
</Schema>
<Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
The SAPUI5 Web IDE says that edmx namespace does not exist.
So I went to check edmx namespace and it does not exists.
Chrome developer tools reports the same error:
Could this be the problem?
I checked and mockserver.init() is triggered.
Did Microsoft moved this namespace somewhere? Cause I was not able to find it.
Thanks
what I see is that you messed up your XML structure. As the error says your XML is invalid.
You've closed the surrounding edmx:Edmx tag at the beginning of the document
You've closed the edmx:DataServices tag too early
Furthermore the attribute name of the property id is in lowercase. Try to make an uppercased Name.
Try to use this xml:
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Person">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.Int16" Nullable="false"/>
<Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="email" Type="Edm.String" Nullable="false"/>
<Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
<Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
</EntityType>
</Schema>
<Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
</EntityContainer>
</Schema>
</edmx:DataServices>