Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

UIComponent's Model can not be accessed in View-Controller

$
0
0

Hi,

 

I got the following problem:

I've done the SAPUI5 walkthrough tutorial in which in Component.js a model has been set via following code where this is sap.ui.core.UIComponent

 

var oInvoiceModel = new JSONModel(jQuery.sap.getModulePath(sNamespace, oConfig.invoiceLocal));

this.setModel(oInvoiceModel, "invoice");

 

 

But in view controller I have no access. I have tested some ways like:

 

this.getView().getModel("invoice")

sap.ui.core.UIComponent.getModel("invoice")

...

 

But everytime the result is undefined or empty.

I thought when something is set in Component.js it is aviable everywhere...

 

 

What I want to do in the end is setting a model in Component.js and loop over some data in this model in the controller of the view to build a dynamic UI.

Any ideas how I can accomplish this?

 

 

Thank you,

Dominik


Viewing all articles
Browse latest Browse all 3184

Trending Articles



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