on 01-08-2014 9:36 AM
Hi,
I am creating an MVC mobile application using SAPUI5.I have used JSON model to populate the data.I have done the relevant data binding to UI but the data is not being displayed.
Please find the code I have used to display the data in the List.. All are mobile components(sap.m).
createContent : function(oController) {
var oPage = new sap.m.Page({
title:"Home",
});
var oList = new sap.m.List({headerText: "Countries", items:
[
new sap.m.ObjectListItem("countries", {attachDetailPress : oController.listItemTriggered,
bindContext : "{/countries}"}),
]});
oPage.addContent(oList);
return oPage;
}
This is the MODEL JSON structure,
"countries" : [ {
"name" : "Greece",
"short" : "GR",
"detailInfo": {
"capital": "Athens",
"population": 10787690,
"area": 131990,
"currency": "Euro",
"flagUrl": "http://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Flag_of_Greece.svg/200px-Flag_of_Greece.svg..."
}
Please help me in this.
Thanks,
I have sorted it out,Please find the working code.
this.countryList = new sap.m.List({
headerText : "Countries",
showNoData : false
});
this.countryList.bindAggregation("items", {
path : "/countries",
sorter : new sap.ui.model.Sorter("name", false),
template : new sap.m.StandardListItem({
title : "{name}",
type : sap.m.ListType.Navigation,
customData : [
new sap.ui.core.CustomData({
key: "name",
value: "{name}"
}),
],
tap : [ oController.listItemTriggered, oController ]
})
});
Thanks..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.