avatar image
Former Member

How to bind items and add table data to icontab bar using odata

var icontabbar = new sap.m.IconTabBar({items:[new sap.m.IconTabFilter({id:"idTab1", text:"Categories", content:[ new sap.m.Label("cssid",{ text:"Categories:", textAlign:"Center"}), new sap.m.ComboBox("",{layout:"ResponsiveGridLayout",

name: "Weekday", items: [new sap.ui.core.Item("",{text: "Monday", key: "pcat"}), new sap.ui.core.Item("",{text: "Tuesday", key: "Thu"}), new sap.ui.core.Item("",{text: "Wednesday", key: "Mi"}), new sap.ui.core.Item("",{text: "Thursday", key: "Th"}), new sap.ui.core.Item("",{text: "Friday", key: "Fr"}), new sap.ui.core.Item("",{text: "Saturday", key: "Sa"}), new sap.ui.core.Item("",{text: "Sunday", key: "Su"})], change: function(oEvent){ sap.ui.getCore().byId("TextFieldKey").setValue(oEvent.oSource.getSelectedKey()); sap.ui.getCore().byId("TextFieldId").setValue(oEvent.oSource.getSelectedItemId()); } })]}), new sap.m.IconTabFilter({id:"idTab2", text:"Subcategories"}), new sap.m.IconTabFilter({id:"idTab3", text:"Products", content:[new sap.ui.layout.form.SimpleForm("simpleForm1",{editable:true, title: "Add New Product", content:[ new sap.m.Label({text:"Product ID"}), new sap.m.Input("f1",{value: '', width : "300px"}), new sap.m.Label({text:"Product Name"}), new sap.m.Input("f2",{value:"", width : "300px"}), new sap.m.Label({text:"Price"}), new sap.m.Input("f3",{value:"", width : "300px"}), new sap.m.Label({text:"Product Description"}), new sap.m.Input("f4",{value:"", width : "300px"}), new sap.m.Label({text:"Quantity"}), new sap.m.Input("f5",{value:"", width : "300px"}), new sap.m.Label({text:"Image upload"}), new sap.ui.unified.FileUploader({id:"fileUploader1", name:"myFileUpload", uploadUrl:"upload/", width:"300px", tooltip:"Upload your file to the local server", uploadComplete:oController.handleUploadComplete}), new sap.m.Label({text:""}), new sap.m.Button("upload1",{text:"Upload image", width:"300px", press : oController.handleUploadPress}), new sap.m.Label({text:""}), new sap.m.Button({text : "Add products", width : "300px", icon : "sap-icon://add-product", press : oController.onSave })

] }),new sap.m.Table("table1",{ headerText: "Product List", // selectionChange: oController.onSelectionChange, columns : [ new sap.m.Column({ header :[ new sap.m.Label({text : "Product ID"}) ] }), new sap.m.Column({

header :[ new sap.m.Label({text : "Product Name"}) ] }), new sap.m.Column({

header :[ new sap.m.Label({text : "Price"}) ] }), new sap.m.Column({

header :[ new sap.m.Label({text : "Product Description"}) ] }), new sap.m.Column({

header :[ new sap.m.Label({text : "Quantity"}) ] }) ] }), oTable.setMode(sap.m.ListMode.SingleSelectMaster),

oTable.bindItems("/", new sap.m.ColumnListItem("listItem1",{ cells : [ new sap.m.Text({text : "{ProductID}"}), new sap.m.Text({text : "{Productname}"}), new sap.m.Text({text : "{Price}"}), new sap.m.Text({text : "{Description}"}), new sap.m.Text({text : "{Quantity}"}), new sap.m.Button({ icon : "sap-icon://delete", text : "Delete products", type : sap.m.ButtonType.Reject, press : function(evt) { var oSelectedItem = evt.getParameter("listItem1"); var oPath = oSelectedItem.getBindingContext().getPath().slice(1); // console.log(oPath) ; }, }), new sap.m.Button({ icon : "sap-icon://edit", text : "Update products", press : function(evt) { // console.log("press") }, })] })), new sap.m.Bar({ design : sap.m.BarDesign.Footer, contentRight : [ new sap.m.Button({ icon : "sap-icon://edit", text : "Update products", press : oController.editFunction }), new sap.m.Button({ icon : "sap-icon://delete", text : "Delete products", type :sap.m.ButtonType.Reject, press : oController.deleteFunction })],

content: [menuo, toolbarheader0, oSimpleForm,oTable, icontabbar ] }) ]}), ]});

In the above code instead of using setmode method using object directly to table.

How to achieve In content aggregatons property to display form data to table using local json or odata services.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers

Skip to Content