Skip to Content
avatar image
Former Member

SAP UI5 Modifying an Odata model obtained from manifest before setModel()

I am creating my first SAP UI5 app and I have a need where i want to set an additional property to the data returned from an Odata service before i set it as a model to in the table view

However i am unable to access the data as the getProperty returns an empty object. Below is the code on the onInit() method of my controller . I am obtaining the model from my manifest.json as it looks a clean way to do things.

var rList = this.getOwnerComponent().getModel("Entities");
var localPromise = this.getPromise(rList, "/");
localPromise.done(function() {
    // here i would like to do the manipulations and then set the view      

i assume the getPromise method must take care of the asynchronous execution part:

getPromise: function(oModel, pathToTestForData) {
            var deferred = $.Deferred();
            if (oModel.getProperty(pathToTestForData))
                deferred.resolve(); //Data already loaded
//Waiting for the event
            return deferred.promise();

What i want to do is the following:

1) make the Odata two way bind.

2) set another property : anotherProperty:false on each returned Odata record

However as rList.getProperty("/")inside the done of the promise is empty, i am at a roadblock, Also how to access the data (if it was there)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers