on 11-11-2013 11:21 AM
Hi,
I try to build a simple application that displays a data from Odata service on a SAPUI5 table.
I use simple example I found in this forum here is some code:
Index.html file:
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="resources/sap-ui-core.js" id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.table"
data-sap-ui-theme="sap_goldreflection">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
sap.ui.localResources("odataproductsjs");
var view = sap.ui.view({
id : "idFirstView1",
viewName : "odataproductsjs.FirstView",
type : sap.ui.core.mvc.ViewType.JS
});
view.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
FirstView.view.js file
createContent : function(oController) { |
var oTable = new sap.ui.table.Table(); | |
var oModel1 = new sap.ui.model.odata.ODataModel("http://services.odata.org/Northwind/Northwind.svc"); | |
oTable.setModel(oModel1); | |
oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "ID"}),template: new sap.ui.commons.TextView({text: "{CustomerID}"})})); | |
oTable.bindRows("/Customers"); | |
oTable.placeAt("content"); | |
}
When I run the project on a tomcat server the Chrome browser displays a Table with lines however the text of the line is empty.
Ideas will be grateful,
Thank You,
Eyal
Hi Eyal,
I don't think there is any problem in the code. It worked perfectly fine for me. However it takes some time and the table rows appears blank for a while until data is received.
I think you are getting some other error - most probably a CORS issue.
If you are using chrome browser, press F12 to open developer tools and then check Console tab to see the errors.
Regards,
Atanu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.