I'm trying to bind a local JSON data(in file) to a <SELECT>/<ComboBox> element, I could see the data being pulled by the server. However, the data is not getting bound to element. Please help.
--- Controller
sap.ui.define([
'jquery.sap.global',
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel'
], function(jQuery, Controller, JSONModel) {
"use strict";
var PageController = Controller.extend("survey.App", {
onInit: function () {
var oModel = new JSONModel(jQuery.sap.getModulePath("sap", "/products.json"));
this.getView().setModel(oModel);
console.log(oModel);
}
});
return PageController;
});
-- XML VIEW
<mvc:View
height="100%"
controllerName="survey.App"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<Page showHeader="true">
<content>
<ComboBox id="prodlist"
items="{
path: '/ProductCollection',
sorter: { path: 'Name' }
}">
<core:Item key="{ProductId}" text="{Name}" />
</ComboBox>
<!-- <Select
items="{
path: '/ProductCollection',
sorter: { path: 'Name' }
}">
<core:Item key="{ProductId}" text="{Name}" />
</Select> -->
</content>
</Page>