view.controller.js:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("xmltable.view", {
onInit: function() {
var datapath=
[{"name":"Sai Giridhar","company":"SAP"},
{"name":"Vignesh","company":"TCS"},
{"name":"Mike","company":"SAP"}];
var oModel = new sap.ui.model.json.JSONModel(datapath);
this.getView().setModel(oModel);
}
});
});
view.view.xml:
<core:View
xmlns:core="sap.ui.core"
controllerName="xmltable.view"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:table="sap.ui.table">
<Page title="table">
<content>
<table:Table id="Table1" rows="{/}">
<table:title>
<Text text="SAPUI5 sap.ui.table XML view"></Text>
</table:title>
<table:columns>
<table:Column sortProperty="name" filterProperty="name">
<Label text="Employee name"/>
<table:template><Text text="{name}" ></Text></table:template>
</table:Column>
<table:Column sortProperty="company" filterProperty="company">
<Label text="Company"/>
<table:template><Text text="{company}" ></Text></table:template>
</table:Column>
</table:columns>
</table:Table>
</content>
</Page>
</core:View>
output:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("xmltable.view", {
onInit: function() {
var datapath=
[{"name":"Sai Giridhar","company":"SAP"},
{"name":"Vignesh","company":"TCS"},
{"name":"Mike","company":"SAP"}];
var oModel = new sap.ui.model.json.JSONModel(datapath);
this.getView().setModel(oModel);
}
});
});
view.view.xml:
<core:View
xmlns:core="sap.ui.core"
controllerName="xmltable.view"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:table="sap.ui.table">
<Page title="table">
<content>
<table:Table id="Table1" rows="{/}">
<table:title>
<Text text="SAPUI5 sap.ui.table XML view"></Text>
</table:title>
<table:columns>
<table:Column sortProperty="name" filterProperty="name">
<Label text="Employee name"/>
<table:template><Text text="{name}" ></Text></table:template>
</table:Column>
<table:Column sortProperty="company" filterProperty="company">
<Label text="Company"/>
<table:template><Text text="{company}" ></Text></table:template>
</table:Column>
</table:columns>
</table:Table>
</content>
</Page>
</core:View>
output:
No comments:
Post a Comment