Skip to Content
0
Former Member
Sep 15, 2014 at 07:15 PM

Bind Odata records to UI5 table

26 Views

Hi All,

I am trying to bind the values coming from Odata gateway service to UI5 table. I have done the code like below but I am unable to bind the values to table. Can you please help me how to retrieve collection of data and bind to table.

var oTable = new sap.ui.table.Table("Sampletable");

var sServiceUrl = "/sap/opu/odata/sap/ZTEST_SERV_SRV/";

var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);

oTable = sap.ui.getCore().byId("Sampletable");

oTable.setModel(oModel);

var oDropdownBox2 = new sap.ui.commons.DropdownBox(

"DropdownBox2", {

tooltip : "Materials",

displaySecondaryValues : true,

"association:listBox" : oListBox1

});

oDropdownBox2

.attachChange(function() {

var oVal = oDropdownBox2.getValue();

alert(oVal);

OData.read("/sap/opu/odata/sap/ZTEST_SERV_SRV/matsavdataSet?$filter=Material ge '000000000000000476' and Material le '000000000000000480'",

function (oData, oResponse)

{

},

function(oError){

alert("Read failed");}

);

});

oPanel.addContent(oDropdownBox2);

oPanel.addContent(oTable);

Regards,

Suresh