Quantcast
Channel: SCN: Message List - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 8124

Data through JSON file

$
0
0

Hello All

 

Have a json file(emp.json) which contains employee data, want to instantiate model in controller then want to make use in UI (bind it to ui form fields).

 

emp.json:

 

{

     firstName: "John",

     lastName: "Doe",

     birthday: {day:01,month:05,year:1982},

     address:[{city:"Heidelberg"}],

     enabled: true

}

 

test.controller.js

 

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

 

sap.ui.getCore().setModel(oModel);

 

test.view.js:

 

var oTxt = new sap.ui.commons.TextField("txtField", {

     value: "{/firstName}"

  });

 

But output data from file is not displaying in text field, Please correct me if i coded wrongly.

 

 

Thanks

Sri


Viewing all articles
Browse latest Browse all 8124

Trending Articles



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