Skip to Content
0
Former Member
Apr 25, 2014 at 05:54 AM

Issue in binding item data to sap.m.List control

121 Views

Hi All,

I am facing an issue while trying to bind data out of the following json to my sap.m.List control.The "Product_ID" from the following json is not getting populated as my list item. Please have a look into the following code snippet.

JSON Structure

--------------------------

var data = { "d" :

{

"__metadata": {

"uri":"http",

"type":"HANA_Data"

},

"Product_ID":"A5AA010000",

"Unit":"EA",

"Brand":21,

"Category":17,

"ZMAJORCAT":510,

"ZPRODLINE":173,

"Product_Family":"A5AA",

"Subcategory":"28",

"ZSUBPRDLN":"C48",

"ZSALESDIV":21,

"ABC":"C",

"XYZ":null,

"ABC_XYZ":"C"

}

};

UI5 Code Snippet

------------------------------------

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

oModel.setData(data);

var standlist = new sap.m.List({

mode:"SingleSelectMaster",

select: function(oEv) {

alert(oEv.getParameter("listItem").getTitle());

}});

var oListItem = new sap.m.StandardListItem({title : "{Product_ID}", description: "Test Description"});

standlist.setModel(oModel);

standlist.bindAggregation("items","/d" , oListItem);

Basically I am trying to bind the Product_ID as my List item.

Can you please help?

Thanks

Laboni