I am trying to change my OData version as V1 in my Web IDE,I tried by keeping the below code in model object in mainfest.json
.
"": {
"type": "sap.ui.model.odata.ODataModel",
"dataSource": "mainService",
"settings": {
"metadataUrlParams": {
"sap-documentation": "heading"
}
}
}
when the control comes to component.js, this.getModel()
gives me OData version as V1, but when I am executing this line
UIComponent.prototype.init.apply(this, arguments);
giving me the error as
Uncaught TypeError: this.getOwnerComponent(...).getModel(...).metadataLoaded is not a function.
I am developing SAPUI5
Master-Detail application in Web IDE. How to solve this? Any suggestions?
答案 0 :(得分:0)
从1.28到更高的差异是metadataLoaded-function。 SAP在他们的版本中改变了它......糟糕的habbit btw。
在1.28中你需要在没有承诺的情况下使用它:
oDataModel.onMetadataLoaded(function(data) {
console.log('finished', data);
});
1.28以上你可以使用它承诺
oDataModel.metadataLoaded().then(function(data) {
console.log('finished', data);
});