Skip to Content

Read the default model in Sap Web Ide


I would like your help to access models in the Sap Web Ide, using the manifest.json. Previously, I used to instantiate a JSONModel and then could access this model using its ID.

var oUserDataModel = new sap.ui.model.json.JSONModel(data);
sap.ui.getCore().setModel(oUserDataModel, "UserData");

var modelUser = sap.ui.getCore().getModel("UserData");

However, using the manifest.json, especially when it is the default model, I don't know how to access this model in order to make some changes in its structure.

Is it possible to do read models in the same way with these created in manifest? For example...

var modelUser = sap.ui.getCore().getModel("Default");

And when it isn't a default model? What would change?

I have attached a print screen of my manifest.json, with an example from Northwind oData.

Thank you in advance, Rogerio

duvida.png (16.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 01, 2017 at 06:00 AM


    I can see you are instantiating OData Model as default model.

    So if you are accessing the model from Component controller, you can access it using below code :

    var oModel = this.getModel();

    If you want to access it in controllers, use below code :

    var oModel = this.getOwnerComponent().getModel();

    As your Odata model is a default model, no need to pass any model name in getModel() method.

    I hope you are clear with the above explanation.


    Karan Shaheri.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2018 at 10:55 AM

    Rogerio if its not a default model then we will have to pass the model name. this.getView().getModel("modelName")

    Add comment
    10|10000 characters needed characters exceeded