0

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?

4

1 回答 1

0

从 1.28 到更高版本的区别在于 metadataLoaded-function。SAP在他们的版本中改变了它......顺便说一句坏习惯。

在 1.28 中,您需要在没有承诺的情况下使用它:

oDataModel.onMetadataLoaded(function(data) {
    console.log('finished', data);
});

高于 1.28 你可以使用它与承诺

oDataModel.metadataLoaded().then(function(data) {
   console.log('finished', data);
});
于 2016-05-11T13:45:24.673 回答