Skip to Content
2
Feb 12 at 02:13 PM

UploadSet not showing icons

222 Views Last edit Feb 12 at 02:33 PM 6 rev

I am using an sap.m.upload.UploadSet to upload and show uploaded files. When i add a File, the Icon is displayed correctly in the UploadSetItem. But when i want to show uploaded files, it shows them without icon (see screenshot above) and I get this error:

Assertion failed: Element sap.ui.core.Icon#__item7-icon: Property 'src' (value: '') should be a valid Icon URI (sap-icon://...)

The UploadSetItem itself has no Icon-Property, this is the Files-Data loaded from the backend:

This is my method where i generate the UploadSetItems, based on the oData loaded:

createAttachmentItems: function (oData) {
var aItems = [];
var oItemContainer = {};
var oUploadSet = this.getView().byId("attachmentUpl");
oUploadSet.removeAllItems();

for (var i in oData.results) {
var oUploadSetItem = new sap.m.upload.UploadSetItem({
fileName: oData.results[i].Filename,
mediaType: oData.results[i].Mimetype,
uploadState: sap.m.UploadState.Complete,
thumbnailUrl: null
});
var oAttribute1 = new sap.m.ObjectAttribute({
title: "Hochgeladen von",
text: oData.results[i].Creatorname,
active: true
});
var oAttribute2 = new sap.m.ObjectAttribute({
title: "Hochgeladen am",
text: oData.results[i].Createdon,
active: false
});
var oAttribute3 = new sap.m.ObjectAttribute({
title: "Dateigröße",
text: "TODO",
active: false
});
oUploadSetItem.addAttribute(oAttribute1);
oUploadSetItem.addAttribute(oAttribute2);
oUploadSetItem.addAttribute(oAttribute3);
oUploadSet.addItem(oUploadSetItem);
}
},

And this ist the xml:

<up:UploadSet id="attachmentUpl" instantUpload="false" showIcons="true" uploadEnabled="true" terminationEnabled="true"
maxFileNameLength="30" maxFileSize="20" uploadUrl="/sap/opu/odata/sap/ZPM_TEST_ODATA_SRV/AttachmentsSet"
uploadCompleted="onUploadCompleted" fileTypes="pdf,doc,docx,docm,ppt,pptx,xls,xlsx,jpg,jpeg,png" fileTypeMismatch="onFileTypeMismatch"
fileSizeExceeded="onFileSizeExceeded">
</up:UploadSet>