cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot call method 'getODataModel' of undefined

former_member193140
Active Participant
0 Kudos

Hi all, I am trying to call this statement in the onInit function:

this.oApplicationFacade.getODataModel().attachRequestCompleted(jQuery.proxy(this.onRequestCompleted,this));


onInit : function() {

  jQuery.sap.require("sap.ca.scfld.md.ComponentBase");

  this.oApplicationFacade.getODataModel().attachRequestCompleted(jQuery.proxy(this.onRequestCompleted,this));

  .......

    },

I am getting this error message: Uncaught TypeError: Cannot call method 'getODataModel' of undefined What went missing here?

Could someone give an example how to use it?

Thank you

Ferry

Accepted Solutions (0)

Answers (1)

Answers (1)

koolspy_ultimate
Active Contributor
0 Kudos

Hi Ferry,

Did you debug and Check oApplicationFacade ?

Regards,

Madhumahesh.

former_member193140
Active Participant
0 Kudos

Hi Madhumahesh,

Actually, I am trying to implement the function from the SAP Fiori Change Sales Order. This is the original source code from the Fiori app:


sap.ca.scfld.md.controller.BaseMasterController.extend("cus.sd.salesorder.monitor.view.S2", {

        onInit : function() {

    

            sap.ca.scfld.md.controller.BaseMasterController.prototype.onInit.call(this);

            this.oApplicationFacade.getODataModel().attachRequestCompleted(jQuery.proxy(this.onRequestCompleted, this));

        

            this.getView().getModel().attachRequestSent(jQuery.proxy(this.onRequestSent, this));

         

            this.setDefaultSelection = false;

            this.numberOfRows = 0;

            this.numberOfItems = 0;

            this.resourceBundle = this.oApplicationFacade.getResourceBundle();

            var oModel = new sap.ui.model.json.JSONModel();

            oModel.setProperty("Contacts", []);

            this.oApplicationFacade.setApplicationModel("contacts", oModel);

        //    this.getView().getModel().bCountSupported=true;     // FIXME: Enable expensive calls for count to make SalesOrder growing list

         

            this.getView().addEventDelegate({

                onAfterShow : jQuery.proxy(this.onShow, this)

            });

     

    },

But I am stuck when calling the oApplicationFacade.getODataModel() in my code.  This is the output of console.log of the fiori app :



Can you provide an example how to call that method in your own code?


Thanks again

former_member193140
Active Participant
0 Kudos

Ok. I found the OData format already.

Former Member
0 Kudos

Hi Ferry, how did you resolved this?

How can I access the content of oApplicationFacade.getODataModel() result?

Thank you

Hazam_koyaty
Explorer
0 Kudos

Do u got answer to your question. How do we access the contents of
oApplicationFacade.getODataModel() result.