Hello Experts,
I am trying to bind the rows of a UI5 with a XML model. The problem is, even though I have two entries in the XML data, the table only shows the first entry.
Code for Table:
var oTable = new sap.ui.table.Table("myTab",{ columns : [ {label: "Category", template: "d:CategoryName"}, {label: "Name", template: "d:ProductName" }, {label: "Sales", template: "d:ProductSales"} ] });
Code for DataBinding:
var oModel = new sap.ui.model.xml.XMLModel(); var xmldata = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'+ '<feed xml:base="http://services.odata.org/Northwind/Northwind.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">'+ '<entry>'+ '<content type="application/xml">'+ '<m:properties>'+ '<d:CategoryName>Beverages</d:CategoryName>'+ '<d:ProductName>Chang</d:ProductName>'+ '<d:ProductSales m:type="Edm.Decimal">7038.5500</d:ProductSales>'+ '</m:properties>'+ '</content>'+ '</entry>'+ '<entry>'+ '<content type="application/xml">'+ '<m:properties>'+ '<d:CategoryName>Beverages1</d:CategoryName>'+ '<d:ProductName>Chang1</d:ProductName>'+ '<d:ProductSales m:type="Edm.Decimal">8198.5500</d:ProductSales>'+ '</m:properties>'+ '</content>'+ '</entry>'+ '</feed>' ; oModel.setXML(xmldata); oTable = sap.ui.getCore().byId("myTab"); oTable.setModel(oModel ); oTable.bindRows("/entry/content/m:properties");
What could be the reason of error?