on 11-02-2015 1:13 AM
Hello, Experts.
I am trying to bind oData service to sap.m.Table, but with no success. So far I am really lost and don't know that to do.
In Component.js i wrote following code, it does return metadata:
sap.ui.core.UIComponent.extend("test.Component",{
metadata: {
manifest: "json"
},
init: function() {
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
var oModel = new sap.ui.model.odata.v2.ODataModel("proxy/http/services.odata.org/V2/Northwind/Northwind.svc/", false);
sap.ui.getCore().setModel(oModel, "products");
}
});
Then i created a view, where i was hoping i can show data:
sap.ui.jsview("test.Absence_list", {
getControllerName : function() {
return "test.controller.Absence_list";
},
createContent : function(oController) {
var oTable = new sap.m.Table("Test_table");
oTable.setWidth("100%");
var oColumn = new sap.m.Column({
header: new sap.ui.commons.Label({text: "ID"})
});
oTable.addColumn(oColumn);
var oColumn = new sap.m.Column({
header: new sap.ui.commons.Label({text: "Name
});
oTable.addColumn(oColumn);
var oItems = new sap.m.ColumnListItem();
var oCell = new sap.m.Label({text:"{products>ID}"});
oItems.addCell(oCell);
var oCell = new sap.m.Label({text:"{products>Name}"});
oItems.addCell(oCell);
oTable.bindItems({path: "products>/Products", template: oItems});
return oTable;
}
})
But nothing happens, it just shows "no data".
Please, help me find a solution.
Hi Konstantin,
S1:
var oModel = newsap.ui.model.odata.v2.ODataModel("proxy/http/services.odata.org/V2/Northwind/Northwind.svc/", false);
Could you please change the request url to: proxy/http://services.odata.org/V4/Northwind/Northwind.svc/
S2:
Goto Console---->type sap.ui.getCore().getModel("product");
Thanks,
KA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.