on 05-28-2015 9:20 AM
Hi ,
Am very new to SAP UI 5 , started devlopeing a Table in SAP.M.Table
Here is my XML View and copied and modified from Explored demo
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:model="sap.ui.model"
controllerName="tableviewsettings.TableView" xmlns:html="http://www.w3.org/1999/xhtml">
<l:VerticalLayout width="100%">
<l:content>
<Table id="idEmployeeTable" items="{Emp>/EmployeeCollection}">
<headerToolbar>
<Toolbar>
<Title text="Employee Details" level="H2" />
<ToolbarSpacer></ToolbarSpacer>
<Button icon="sap-icon://drop-down-list" press="handleViewSettingsDialogButtonPressed" />
</Toolbar>
</headerToolbar>
<infoToolbar>
<Toolbar id="vsdFilterBar" active="true" visible="false"
press="[handleViewSettingsDialogFilterBarPressed, views.control.tableViewSettingsDialog]">
<Label id="vsdFilterLabel" text="?" />
</Toolbar>
</infoToolbar>
<columns>
<Column width="12em">
<Text text="Employee Id" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Employee Name" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Title" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Hire Date" />
</Column>
<Column hAlign="Center">
<Text text="City" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Region" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Postal code" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Country" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<ObjectIdentifier title="{Emp>/EmpID}" /> <!-- text="{ProductId}" -->
<Text text="{Emp>Name}" />
<Text text="{Emp>Title}" />
<Text text="{Emp>Jdate}" />
<Text text="{Emp>City}" />
<Text text="{Emp>Region}" />
<Text text="{Emp>Pcode}" />
<Text text="{Emp>Country}" />
</cells>
</ColumnListItem>
</items>
</Table>
</l:content>
</l:VerticalLayout>
</mvc:View>
In Controller onInit I have written below code
onInit : function() {
var ctrlr = this;
var dataEmp = {
EmployeeCollection :
[ {
"EmpID" : "31017024",
"Name" : "Nagarjun Kalletla",
"Title" : "Phani",
"Jdate" : "14-07-2014",
"City" : "Bangalore",
"Region" : "Kar",
"Pcode" : "560100",
"Country" : "India" }]
},
var oModel = new sap.ui.model.json.JSONModel("mock.json"); " This code I found some where in SCN not working
this.getView().setModel(oModel, "Emp");
Am getting below error ...
When I tried using this below code
var ctrlr = this;
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(dataEmp);
var oTable = ctrlr.getView().byId("idEmployeeTable");
oTable.setModel(oModel);
oTable.bindAggregation("items","/EmployeeCollection");
Am getting
Missing template or factory function for aggregation items of Element sap.m.Table#idTableView1--idEmployeeTable !
Can any body help me to solve this issue...
after set model for the table try this code
var zBinding = zTable.bindItems({path: "/itemstit", template:zTable.getBindingInfo("items").template});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.