Hi,
What is error you are getting in your browser' console. Press F12 to check it.
This is basically a binding problem.
How you have used this URL?
var oModel = new sap.ui.model.ODataModel("http://services.odata.org/OData/OData.svc");
here this may be cross origin related issue so use proxy for it.
like this.
var oModel = new sap.ui.model.ODataModel("proxy/http/services.odata.org/OData/OData.svc");
Use Appropriate path for binding.
This might be also the version issues of OData.
Check it.
Write this on onInit method of controller.
onInit: function() {
var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V3/(S(3ngooq0fkelm0nublhbj01xu))/OData/OData.svc");
oModel.oHeaders = {
"DataServiceVersion": "3.0",
"MaxDataServiceVersion": "3.0"
};
sap.ui.getCore().setModel(oModel,"products"); //or this.getView().setModel(oModel, "products");
},
in controller write like this.
var oTable = new sap.ui.table.Table("tableId",{
visibleRowCount: 5,
editable: false
});
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "ID"}),
visible: true,
template: new sap.ui.commons.TextView({text: "{products>ID}"})
}));
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Name"}),
visible: true,
template: new sap.ui.commons.TextView({text: "{products>Name}"})
}));
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text:"Description"}),
visible: true,
template: new sap.ui.commons.TextView({text: "{products>Description}"})
}));
oTable.bindRows("products>/Products");
Regards
Dhananjay