Hi there,
I'm using SAPUI5 1.18.5 and have some strange issues using sap.m.Table.
Here is the code:
<core:View controllerName="com.vendor.CreateInventory" xmlns:m="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:commons="sap.ui.commons"> <m:Page id="createInventoryPage"> <m:Table id="tableID" items="{ path: '/data'}"> <m:columns> <m:Column> <m:Label text="{i18n>CREATE.INV_ID}" design="Bold" /> </m:Column> <m:Column> <m:Label text="{i18n>CREATE.QUANTITY}" design="Bold" /> </m:Column> </m:columns> <m:items> <m:ColumnListItem> <m:cells> <m:Input id="inventoryInputField" value="{inventory}" /> <m:Input id="quantityInputField" value="{quantity}" /> </m:cells> </m:ColumnListItem> </m:items> </m:Table></core:View>
And the controller:
sap.ui.controller("com.vendor.CreateInventory", { onInit : function() { this.tableModel = new sap.ui.model.json.JSONModel(); sap.ui.getCore().setModel(this.tableModel, "tableView"); }, onBeforeRendering : function() { // render input fields var quantity = 50; var lotSize = 5; var cells = quantity / lotSize; var dataObject = { data : [] }; for ( var i = 1; i <= cells; i++) { dataObject.data.push({ inventory : "", quantity : "" }); } this.tableModel.setData(dataObject); this.getView().byId("tableID").setModel(this.tableModel); } });
I use a sap.m.Table to generate 10 rows of input fields. However, it doesn't work. It always displays "No data" when loading the page.
I pass an array of 20 entries to the model. The binding takes place at the XML above using the samples provided by sap.m.explored.
Are there any ideas what I'm doing wrong?
Thanks for any help.
Regards,
Tobias