Hello,
I have a problem with the itemPress function in sap.m.Table. The table item contains two icons with press functions (one icon for download and one for delete). What I would like the code to do is when I press the icon, the itemPress triggers in the table and the item data is read and the following download or delete action is performed.
The solution where there was the ItemPress function inside of the table and the press function inside of the icon actually worked for me before (before updating the ui5 components in backend)..
But now (after the update) it seems, that the press on the icon is not registered as a table item press (only changes the boolean and does not go into the itemPress - see code below). For this I then tried to use the fireItemPress function, but I didn't know how to pass the data correctly. Could You please help me solve this issue?
Here is the code, that worked for me previously (now not any more) ..
var filetable = new sap.m.Table("freeform-filetable", { selectionMode: sap.ui.table.SelectionMode.Single, noDataText: "No attachments uploaded", itemPress: function(evt) { var oSelectedItem = evt.getParameter("listItem"); var docId = oSelectedItem.getBindingContext().getProperty("ImDocid"); var docName = oSelectedItem.getBindingContext().getProperty("ImDocoutname"); var mimeFull = oSelectedItem.getBindingContext().getProperty("ImMime"); var downloadAndDeleteBoolean = fileManagement.tableItemPress(docId,docName,mimeFull,deleteDoc,downloadDoc,Formid,"freeform-filetable"); deleteDoc = downloadAndDeleteBoolean[0]; downloadDoc = downloadAndDeleteBoolean[1]; }, visibleRowCount: 3, columns: [ new sap.m.Column({}), new sap.m.Column({ visible: false }), new sap.m.Column({ visible: false }), new sap.m.Column({ width: "50px" }), new sap.m.Column("vabaVormDeleteColumn",{ width: "50px" }) ], items: { path: "/results", template: new sap.m.ColumnListItem({ type: "Active", cells: [ new sap.m.Text("ImDocname", { text: "{ImDocoutname}" }), new sap.m.Text("ImMime", { text: "{ImMime}" }), new sap.m.Text("ImDocid", { text: "{ImDocid}" }), new sap.ui.core.Icon("file_download",{ src: "sap-icon://download", size: "25px", hoverColor: "#33ADFF", press: function() { //The press does not trigger the itemPress any more.. downloadDoc = true; // TO FIX THE PROBLEM I TRIED SOMETHING LIKE THIS: //sap.ui.getCore().byId("freeform-filetable").fireItemPress(); } }), new sap.ui.core.Icon({ src: "sap-icon://delete", size: "25px", hoverColor: "#33ADFF", press: function() { //The press does not trigger the itemPress any more. deleteDoc = true; } }) ] }) } });
Any help is appreciated !
Thank You.
Mario.