我在dataSources
"dataSources": {
"mainService": {
"uri": "/backend/service/v1/entity.svc/",
"type": "OData",
}
}
"models": {
"": {
"dataSource": "mainService",
"preload": true,
"settings" : {
"sizeLimit" : 500,
"useBatch" : false,
"refreshAfterChange": false,
"defaultBindingMode": "TwoWay",
"defaultCountMode" : "None",
"defaultUpdateMethod" : "Put"
}
}
}
但由于某些原因我不知道,ui5项目会在初始加载时调用GET /backend/service/v1/entity.svc/
,这会返回几个<collection>
。
但是当我将UseBatch设置为true时,批处理的GET请求将失败,有效负载如下:
--batch_67d5-9dc2-70e0
Content-Type: application/http
Content-Transfer-Encoding: binary
GET HTTP/1.1
sap-contextid-accept: header
Accept: application/json
Accept-Language: en-US
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
sap-cancel-on-close: true
--batch_67d5-9dc2-70e0-
由于看似没有GET请求,批量请求肯定会失败。是否有任何UI5 / oData专家可以告诉我GET /entity.svc的重点是什么,如何修复此批处理或如何跳过此请求?
答案 0 :(得分:0)
我发现它是由sap.m.Table
_bindView : function (sObjectPath) {
var sAssignedPath = sObjectPath + "/assignedThings",
this._oModel.read(sAssignedPath , {
success : this._handleGetAssignedSuccess.bind(this, sAssignedPath),
error : this._handleGetAssignedError.bind(this)
});
oTable.setModel(this._oModel);
}
_handleGetAssignedSuccess : function (sAssignedPath, oMsg) {
var oTable = this.getView().byId("tableView").byId("assignTable"),
oJSONModel = new JSONModel(oMsg.results);
oAssignTable.setModel(oJSONModel);
},
//AssignTable.view.xml
<Table
id="assignTable"
inset="true"
items="{
path: '/'
}"
>
items="{path: '/'}"
意味着在JSON Model数据绑定中使用,但它也触发了oData GET'/'Request。