Hello Experts,
as the title suggests, I am currently trying to fill a sap.ui.comp.smarttable.SmartTable. After initial problems I was very happy to finally see an example at SAPUI5 Explored. When I copy the sample code into a new Eclipse project it runs (the mock files are missing but the columns are created successfully). However as soon as I try to include an OData service all attempts fail.
I guess a small code snippet says more than 1000 words:
Working:
View.js
this.table = new sap.ui.comp.smarttable.SmartTable({entitySet : "
LineItemsSet"
});
Controller.js
onInit: function() {
var oModel, oView;
jQuery.sap.require("sap.ui.core.util.MockServer");
var oMockServer = new sap.ui.core.util.MockServer({
rootUri: "foo/"
});
this._oMockServer = oMockServer;
oMockServer.simulate("mockserver/metadata.xml", "mockserver/");
oMockServer.start();
oModel = new sap.ui.model.odata.ODataModel("foo", true);
oModel.setCountSupported(false);
oView = this.getView();
oView.setModel(oModel);
},
As I said the columns are created and only the data is missing (due to the files not being published in the sample).
Not Working:
View.js
this.table = new sap.ui.comp.smarttable.SmartTable({entitySet : "
Categories"
});
Controller.js
onInit: function() {
var oModel = new sap.ui.model.odata.ODataModel("");
oModel.oMetaModel = oModel.getMetaModel(); //i examined the working model and this one in the debugger and the missing oMetaModel property was the only thing that caught my attention. so i added it by hand. make no difference though
this.getView().setModel(oModel);
The table stays empty without and columns or data. The only errors are due to the missing Component-preload.js and Component-changes.json files. This should be no problem.
Any ideas?