on 10-27-2015 7:27 AM
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.
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>");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.