Hi Pauline,
Same issue I had, I switched to using a sap.m.list and handling the press as follows:
attachmentsList.bindItems(workItemPath + "/Attachments", new sap.m.StandardListItem({
type: sap.m.ListType.Active,
title: "{FileName}",
description: "{CreatedByName}",
icon: "sap-icon://doc-attachment",
// counter: "{FileSize}",
info: {path : "CreatedAt", formatter: dateTimeFormatter},
tap: function(oEvent){
var oContext = oEvent.getSource().getBindingContext();
var media_src = oContext.getProperty().__metadata.media_src;
sap.m.URLHelper.redirect(media_src, true);
}
}), new sap.ui.model.Sorter("CreatedAt", true));
So sap.m.URLHelper.redirect(media_src, true); is what loads the attachment.
See the full function handler:
function(oEvent){
function(oEvent){
var oContext = oEvent.getSource().getBindingContext();
var media_src = oContext.getProperty().__metadata.media_src;
sap.m.URLHelper.redirect(media_src, true);
}
This should be enough if you only want to list and display the attachments, then you don't really need the FileUploader control as that is more advanced and handles upload, display, change and deletion of files.
I only needed to upload and display files, so I used a list to display it and created a separate upload button using the sap.ui.unified.FileUploader control.
Hope that helps.
Cheers,
Brad