问题描述
我正在使用 manifest.json
设置默认模型
"dataSources": {
"mainService": {
"uri": "/sap/opu/odata/sap/Z*****_SERV1_CDS/","type": "OData","settings": {
"annotations": [
"Z*****_SERV1_CDS_VAN"
],"odataVersion": "2.0","localUri": "localService/Metadata.xml"
}
},"Z*****_SERV1_CDS_VAN": {
"uri": "annotation/Z*****_SERV1_CDS_VAN.xml","type": "ODataAnnotation","settings": {
"localUri": "annotation/Z*****_CDS_VAN.xml"
}
},"chartDataService": {
"uri": "/sap/opu/odata/sap/Z*****_SERV1_CDS/","settings": {
"odataVersion": "2.0"
}
}
} .....
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel","settings": {
"bundleName": "ns.Z****_SCRV1.i18n.i18n"
}
},"": {
"dataSource": "mainService","preload": true,"settings": {
"defaultBindingMode": "TwoWay","defaultCountMode": "Inline","refreshAfterChange": false
}
},"chartDataModel": {
"dataSource": "chartDataService","refreshAfterChange": false
}
}
},
默认模型正在加载,并根据需要加载响应。
通过使用键 Z***_SERV1('xyz')
,我绑定了 UI。
但是有一个要求,我需要根据列 ident
传递过滤器,所以我使用了 oData read()
var aFilters = [];
aFilters.push(new sap.ui.model.Filter("ident","EQ","BOTH"));
var oNewModel = this.getView().getModel();
oNewModel.read("/Z*****_SERV1",{
urlParameters: {
"$top": 300,"$skip": 0,"$inlinecount": 'allpages'
},success: function (oData,oResponse) {
console.log("oData",oData);
},error: function (oError) {
console.log("oError ",oError);
},filters: aFilters
});
我收到的响应没有 KEY Z***_SERV1('xyz')
它只是对象数组
我需要更改什么,以便我可以通过 UI 绑定的键获得响应。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)