<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>Selection Screen Table Sample</title>
<!-- 1.) Load SAPUI5 (from a remote server), select theme and control library -->
<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.ui.commons,sap.m,sap.ui.unified,sap.ui.table"
data-sap-ui-xx-bindingSyntax="complex"></script>
<!-- 2.) Create a UI5 button and place it onto the page -->
<script>
var aData = [
{Customer: "1", Country: "IN", Name: "Anand Krishna", Address: "22950"},
{Customer: "2", Country: "IN", Name: "Sasthy", Address: "22953"},
{Customer: "3", Country: "ES", Name: "Sasthy", Address: "22954"},
{Customer: "4", Country: "FR", Name: "Rajesh Sawant", Address: "22958"},
{Customer: "5", Country: "FR", Name: "Mayank", Address: "22959"},
{Customer: "6", Country: "FR", Name: "Aaron", Address: "32958"},
{Customer: "7", Country: "FR", Name: "Benjamin", Address: "22959"},
{Customer: "8", Country: "FR", Name: "Casey", Address: "22958"},
{Customer: "9", Country: "FR", Name: "Raju", Address: "22959"},
{Customer: "10", Country: "FR", Name: "Neha", Address: "22958"}
];
//Create an instance of the table control
var oTable2 = new sap.ui.table.Table("oTable",{
title: "EmployeeTable",
visibleRowCount: 5,
selectionMode: sap.ui.table.SelectionMode.Single,
navigationMode: sap.ui.table.NavigationMode.ScrollBar
});
//Define the columns and the control templates to be used
oTable2.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Customer"}),
template: new sap.ui.commons.TextView().bindProperty("text", "Customer"),
sortProperty: "Customer",
filterProperty: "Customer",
width: "200px"
}));
oTable2.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Name"}),
template: new sap.ui.commons.TextView().bindProperty("text", "Name"),
sortProperty: "Name",
filterProperty: "Name",
width: "200px",
hAlign: "Center"
}));
//Create a model and bind the table rows to this model
var model = new sap.ui.model.json.JSONModel();
model.setData({
modelData: {
employeesData : {}
}
});
sap.ui.getCore().setModel(model);
sap.ui.getCore().getModel().setProperty("/modelData/employeesData", aData)
oTable2.bindRows("/modelData/employeesData");
oTable2.placeAt("uiArea");
</script>
</head>
<body class="sapUiBody">
<!-- This is where you place the UI5 button -->
<div id="uiArea"></div>
</body>
</html>
// Code goes here
/* Styles go here */