jQuery.sap.require("sap.m.MessageToast");
// Controller definition
sap.ui.controller("local.controller", {
onInit: function() {
var data = [{
name: "asd",
amount: "100",
currency: "USD",
size: "L"
}, {
name: "asd",
amount: "800",
currency: "INR",
size: "XL"
}, {
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
},{
name: "asd",
amount: "454",
currency: "USD",
size: "S"
}];
var oModel = new sap.ui.model.json.JSONModel(data);
this.getView().setModel(oModel);
var table = this.getView().byId("tableid");
var mytemplate = new sap.m.ColumnListItem({
cells: [
new sap.m.Text({
text: "{name}"
}), new sap.m.Text({
text: "{amount}"
}), new sap.m.Text({
text: "{currency}"
}), new sap.m.Text({
text: "{size}"
})
]
});
table.bindAggregation("items",{
path: "/",
template : mytemplate
});
}
});
// Instantiate the View, assign a model and display
var oView = sap.ui.xmlview({
viewContent: jQuery('#view1').html()
});
oView.placeAt('content');
<!DOCTYPE HTML>
<html>
<head>
<meta name="description" content="temp">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title></title>
<script id="sap-ui-bootstrap" type="text/javascript" src="https://sapui5.ap1.hana.ondemand.com/resources/sap-ui-cachebuster/sap-ui-core.js" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m" data-sap-ui-xx-bindingSyntax="complex">
</script>
<!-- XML-based view definition -->
<script id="view1" type="sapui5/xmlview">
<mvc:View controllerName="local.controller" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<App>
<Page title="My View" id="page">
<ScrollContainer
height="200px"
vertical="true"
>
<Table id="tableid" sticky="ColumnHeaders">
<columns>
<Column>
<Text text="column1" />
</Column>
<Column>
<Text text="column2" />
</Column>
<Column>
<Text text="column3" />
</Column>
<Column>
<Text text="column4" />
</Column>
</columns>
</Table>
</ScrollContainer>
</Page>
</App>
</mvc:View>
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>