I am using sap.m.List to display some data. The data is coming from the JSON Model, it also has data. But somehow the binding is not working and data is not displayed in the List view. Even there is no error.
purchaseHistory.view.xml
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="novigoapplications.SuperMarket.controller.purchaseHistory" xmlns:html="http://www.w3.org/1999/xhtml">
<App>
<pages>
<Page title="Title">
<content>
<List headerText="Purchase History" width="60%" items="{ path: 'purchaseHistoryData>/Result' }" id="history">
<items>
<StandardListItem title="{purchaseHistoryData>PurchaseId}"></StandardListItem>
</items>
</List>
</content>
</Page>
</pages>
</App>
</mvc:View>
purchaseHistory.controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("novigoapplications.SuperMarket.controller.purchaseHistory", {
onInit: function () {
var oModel = new sap.ui.model.odata.v2.ODataModel("/sap/opu/odata/sap/ZGW_UI5_SUPER_MARKET_SRV");
sap.ui.getCore().setModel(oModel, "purchaseHistory");
var model = sap.ui.getCore().getModel("purchaseHistory");
model.setHeaders({
"X-Requested-With": "X"
});
var readURL = "/CustomerSet('" + window.custid + "')/CusttopurNav";
model.read(readURL, {
success: function (oData, oResponse) {
var purchaseHistoryData = new sap.ui.model.json.JSONModel({
"Result": oData.results
});
sap.ui.getCore().setModel(purchaseHistoryData, "purchaseHistoryData");
}
});
}
});
});