cancel
Showing results for 
Search instead for 
Did you mean: 

Uncaught TypeError: Cannot read property 'layout' of undefined error is coming in value help dialogue while displaying data

Former Member
0 Kudos

hi all,

var layout = new sap.ui.commons.layout.MatrixLayout('layout');

  var rPannel = new sap.ui.commons.Panel('rPannel'); 

  var oTable = new sap.ui.table.DataTable();

     oTable.addColumn( 

          new sap.ui.table.Column({ 

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

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

               

     }));

    

     oTable.addColumn( 

             new sap.ui.table.Column({ 

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

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

                  

        })); 

    

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

             "services.odata.org/Northwind/Northwind.svc/", 

                                 true, 

                                 "usr", 

                                 "passs");

        oTable.setModel(oModel); 

        oTable.bindRows("/CompanyCodeValuehelp");

        rPannel.addContent(oTable);   

        layout.createRow(rPannel); 

        oValueHelpDialog.addContent(layout);

this is my code, contents from odata are notr getting dispalyed. plz help

thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

vijay_kumar49
Active Contributor
0 Kudos

Monika,

in the constructor of the ODataModel  "class" you can add all information you need.

So your example should work nearly with following coding:

// create oDataModel and connect it to service

var oDataModel = new sap.ui.model.odata.ODataModel(<url to your service>, false, <user>, <password>);

// Create table

var oTable = new sap.ui.table.Table();

// add a column to the table

oTable.addColumn(new sap.ui.table.Column({ label: new sap.ui.commons.Label({text:"Test Column Header"}), template: new sap.ui.commons.TextField().bindProperty("value", "<value of oData Model part of path bound to rows (see below)>") }) );

// set oDataModel for table

oTable.setModel(oDataModel);

// bind path of oDataModel to table rows

oTable.bindRows("<path>");