
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="charts.Home" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Products List">
<content>
<List id="idProducts" items="{ProductModel>/results}" noDataText="Loading...">
<StandardListItem title="{ProductModel>ProductName}"/>
</List>
</content>
</Page>
</core:View>onInit: function() {
// local proxy for cross-domain access
// create OData model from Northwind URL
var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/Northwind/Northwind.svc", true);
oModel.read("/Products", null, null, true, fSuccess, fError);
//If data is successfully read
function fSuccess(productdata){
var oProducts = new sap.ui.model.json.JSONModel();
sap.ui.getCore().setModel(oProducts,"ProductModel");
oProducts.setData(productdata);
};
//If fails to read data
function fError(oEvent){
console.log("Error occured while reading Product Data!")
};
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 30 | |
| 21 | |
| 19 | |
| 16 | |
| 13 | |
| 12 | |
| 11 | |
| 11 | |
| 10 | |
| 10 |