Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

how to get the odata model defined in Component.js

$
0
0

hi,

 

I have defined a odata model in the init() function of Component.js as below:

 

var sServiceUrl = 'xxx/xxx/xxx.svc';

var oModel = new sap.ui.model.odata.ODataModel (sServiceUrl, true);

this.setModel (oModel);

 

 

Then I have defined 2 views:  a.view.js and b.view.js

 

a.view.js is returned by the createContent() function of Component.js

b.view.js is embedded in the content of a.view.js.

 

In both views, I can use the bindRow() method of sap.ui.table to bind the data of this model to table.

And I don't have to use the setModel() method of sap.ui.table because the model has already been defined in Component.js.

 

Now I want to use the read() method of ODataModel in my views.

So I need to get an instance of the ODataModel which is defined my Component.js.

 

How can I do it in my view.js? (both a.view.js and b.view.js)

 

Thanks a lot in advance!


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>