Quantcast
Channel: SCN : Unanswered Discussions - SAP Fiori
Viewing all articles
Browse latest Browse all 1879

Table Binding Error

$
0
0

Hi experts ,

I have written a simple code to fetch data in table.I am facing a problem of binding the Odata to the table.

It shows the following error in console

 

Capture.PNG

 

Code Snippet:

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta charset="UTF-8">

 

 

<title>TEST</title>

 

 

<script id="sap-ui-bootstrap" src="resources/sap-ui-core.js"

  data-sap-ui-theme="sap_bluecrystal"

  data-sap-ui-libs="sap.m,sap.ui.core,sap.ui.table,sap.ui.commons"

  data-sap-ui-xx-bindingSyntax="complex"

  data-sap-ui-resourceroots='{

  "sap.ui.zAnalytical": "./"

  }'>

 

</script>

<script>

 

 

     var oModel = new sap.ui.model.odata.ODataModel(

                                   "proxy/http/services.odata.org/V3/Northwind/Northwind.svc",

                                                        false);

     sap.ui.getCore().setModel(oModel);

     var oTable = new sap.ui.table.AnalyticalTable("idAnalytic",{

    visible : true,

     width : "auto",

     visibleRowCount : 5,

     sumOnTop : true,  });

     

     oTable.addColumn(

          new sap.ui.table.AnalyticalColumn({

               label: new sap.ui.commons.Label({text: "SupplierID"}),

               template: new sap.ui.commons.TextField().bindProperty("value", "SupplierID"),

               sortProperty: "SupplierID"

     }));

     

     oTable.addColumn(

          new sap.ui.table.AnalyticalColumn({

               label: new sap.ui.commons.Label({text: "CompanyName"}),

               template: new sap.ui.commons.TextField().bindProperty("value", "CompanyName"),

               sortProperty: "CompanyName"

     }));

       

     oTable.addColumn(

          new sap.ui.table.AnalyticalColumn({

               label: new sap.ui.commons.Label({text: "Contact Name"}),

               template: new sap.ui.commons.TextField().bindProperty("value", "ContactName"),

               sortProperty: "ContactName"

     }));

     

     oTable.addColumn(

          new sap.ui.table.AnalyticalColumn({

               label: new sap.ui.commons.Label({text: "Contact Title"}),

               template: new sap.ui.commons.TextField().bindProperty("value", "ContactTitle"),

               sortProperty: "ContactTitle"

     }));

     

     oTable.addColumn(

          new sap.ui.table.AnalyticalColumn({

               label: new sap.ui.commons.Label({text: "City"}),

               template: new sap.ui.commons.TextField().bindProperty("value", "City"),

               sortProperty: "City"

     }));

     

     oTable.addColumn(

          new sap.ui.table.AnalyticalColumn({

               label: new sap.ui.commons.Label({text: "Country"}),

               template: new sap.ui.commons.TextField().bindProperty("value", "Country"),

               sortProperty: "Country"

     })); 

   

     oTable.setModel(oModel).bindRows("/Suppliers");

 

     oTable.placeAt("content");

 

 

 

</script>

 

 

</head>

<body class="sapUiBody" id="content">

  <div id="content"></div>

</body>

</html>

Please provide some clarity regarding this.


Viewing all articles
Browse latest Browse all 1879

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>