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

setting Model to sap.ui.getCore not working

$
0
0

Hi All,
In controller init event I have

 

var myJSON = {"title":"This is Test"}
oModel.setData(myJSON);
sap.ui.getCore().setModel(oModel, "MyJSONData")

 

In view Create Event I have

var controls = []
controls.push(new sap.ui.commons.Label({                    text:{                              parts:[{path:"MYJSONData>/title"}],                              formatter: function(title)                                   {                                        //will do some formatting and return formatted title                                     }                           }               }));

but it is not binding
But when i changes controller code
as

 

this.getView().setModel(oModel,"MyJSONData")

 

It binds data(title) to View.

 

Question is when I set model to UI5 core object , why it never binds data but when I set model to view it binds the data.
I have several nested views within one parent view and I want same model to be used across all views. I don't want to set separate model for each view.

 

Any help is appreciated ,

Thanks 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>