问题描述
我有一个下拉列表,它在我的应用程序SAP UI5中使用了xsodata服务。该服务在SAP Web IDE Rest Full中以本地模式运行,在部署过程中我没有出错,但是当我测试我的应用程序部署时,下拉列表不起作用,并且在控制台中出现错误。
List Binding is not bound against a list for /MyEntity
当我在下拉列表中单击时,会收到以下消息:
cdm.js:68 Assertion Failed: Type for filter property Could not be found in Metadata!
好像xsodata服务不存在。
PS:此应用程序已部署在SAP Cloud Foundry中。
更新:
My_controller.js
onInit: function () {
oModelHana = new sap.ui.model.odata.ODataModel("xsodata/ServiceHana.xsodata",true);
this.oSelEntity = this.byId("inMyDropdown");
this.oSelEntity.setModel(oModelHana);
}
还有my_view.xml
...
<Label text="Entity"/>
<Select id="inMyDropdown" maxWidth="300rem" items="{/Entity}">
<c:Item key="{EntityID}" text="{description}"/>
</Select>
...
请,你能帮我吗?
解决方法
您正在使用哪种Odata服务?
从UI5 1.48开始不推荐使用 sap.ui.model.odata.ODataModel
所以您必须在两者之间做出决定
sap.ui.model.odata.v2.ODataModel
和
sap.ui.model.odata.v4.ODataModel
那你为什么不define the Model directly in the manifest.json?
manifest.json
"dataSources": {
"xsodataService": {
"uri": "/xsodata/ServiceHana.xsodata/","type": "OData","settings": {
"odataVersion": "4.0"
}
},"models": {
"": {
"dataSource": "xsodataService","settings": {
"synchronizationMode": "None","operationMode": "Server","groupId": "$auto","autoExpandSelect" : true,"earlyRequests": true,"groupProperties": {
"default": {
"submit": "Auto"
}
}
}
},