cancel
Showing results for 
Search instead for 
Did you mean: 

Binding data not displayed

eyal_alsheikh
Active Participant
0 Kudos

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

View Entire Topic
former_member184867
Active Contributor
0 Kudos

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