on 2021 Feb 12 2:13 PM
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>
Request clarification before answering.
Hi Thomas, to show the icon, there must be a valid Filename- extension. e.g "image1.jpg" or "book.pdf" In my case, when i loaded the files from the backend Odata Service it woudln´t have the extension right. It came like "image1.j", so the Fileuploader did not know which icon to show. Once we fixed it in the Backend, it worked.
So check your Filename, when it loads.
Greetings
WP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Waldemar Peters, were you able to solve the problem? I am also facing it.
Best regards
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.