cancel
Showing results for 
Search instead for 
Did you mean: 

model unknow in Demokit Sample BasicODataTreeBinding

0 Kudos

Hi all,

I downloaded the demokit example:

BasicODataTreeBinding

and uploaded it into my workspace.

I added a Button in the view with

press = "onInsert".

In the controller.js I wanted to read the model when the button was clicked:

    		onInsert: function (oEvent) {
    			//Create
    			// https://archive.sap.com/discussions/thread/3605897
    			var oModel = sap.ui.getCore().getModel();

The view works fine:

But the model is empty (aBindings contains nothing)

It seems that I also have to bind/publish the model to the controller? Is that true?

How do I have to do this?

Many Thanks

Regards

Mario

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor
0 Kudos

Hi Mario Mueller

In that example, model is set in the component using the sytax: this.setModel();

so in the view, you should access like show below:

this.getOwnerComponent().getModel();

or this.getView().getModel()

BR,

Mahesh

0 Kudos

Hi Mahesh,

perfect!

this.getOwnerComponent().getModel(); --> worked for me.

Many, many thanks. My headache is gone !

Kind

Regards

Mario

Answers (0)