vijayalalitha
vijayalalitha

Reputation: 57

Issue in changing odata version in webide

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?

Upvotes: 0

Views: 369

Answers (1)

dotchuZ
dotchuZ

Reputation: 2651

the difference from 1.28 to anything higher is metadataLoaded-function. SAP changed it in their Versions... bad habbit btw.

In 1.28 you need to use it without a promise:

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

Above 1.28 you can use it with promise

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

Upvotes: 0

Related Questions