Quantcast
Channel: SCN: Message List - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 8124

table creation in sap ui5

$
0
0

Hi,

I am new at SAP UI5 and i am trying to create a table.

I used the code given on the sap ui5 demokit but when i am running the application the table is not displaying.

 

can anyone help me with this.

 

Thanks in advance.

 

var aData = [          {lastName: "Dente", name: "Al", gender : "male"},          {lastName: "Friese", name: "Andy", gender : "female"},          {lastName: "Mann", name: "Anita", gender : "female"}          ];  //table creation  var oTable = new sap.ui.table.Table({  title: "Guest House list",  visibleRowCount: 3,  firstVisibleRow: 2,  selectionMode: sap.ui.table.SelectionMode.Single,  });  //column creation  oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Last Name"}),  template: new sap.ui.commons.TextView().bindProperty("text", "lastName"),  sortProperty: "lastName",  filterProperty: "lastName",  width: "200px"  }));  oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "First Name"}),  template: new sap.ui.commons.TextField().bindProperty("value", "name"),  sortProperty: "name",  filterProperty: "name",  width: "100px"  }));  oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Gender"}),  template: new sap.ui.commons.ComboBox({items: [  new sap.ui.core.ListItem({text: "female"}),  new sap.ui.core.ListItem({text: "male"})  ]}).bindProperty("value","gender"),  sortProperty: "gender",  filterProperty: "gender"  }));  //data collection  var oModel = new sap.ui.model.json.JSONModel();  oModel.setData({modelData: aData});  oTable.setModel(oModel);  oTable.bindRows("/modelData");  //Initially sort the table  oTable.sort(oTable.getColumns()[0]);  oTable.placeAt("table");

Viewing all articles
Browse latest Browse all 8124

Trending Articles



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