openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

UploadCollection: fileDeleted event does not fire

Open v-schulz opened this issue 11 years ago • 5 comments

The UploadCollection has an event fileDeleted. In the documentation it says: "The event is triggered when the Delete button is pressed." https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.m.UploadCollection.html#event:fileDeleted

However when I press the delete button the event does not fire. I had a very brief look into the code and there all the methods that call fireFileDeleted have some description like "Handling of the termination of an uploading file [/ process]". That rather sounds like the event is only fired during the upload process and not each time, when the delete button is pressed (regardless of the case if the file is just selected or beeing uploaded).

So either the documentation is wrong (too general) or the implementation is incomplete/buggy.

The sample application at https://sapui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.UploadCollectionForPendingUpload/preview does not fire the event (if the description from the documentation is considered). The later case can't be checked because one can't actually upload a file. In a small test with my own implementation and a backend dealing with the file the event did not fire when deleting the file during the upload.

In any case, there should be an event that fires if the file is deleted before the upload has started - otherwise one can only listen to added files to the collection (via "change" event).

v-schulz avatar Oct 14 '15 22:10 v-schulz

Internal incident 1580162645 has been created for this issue.

aborjinik avatar Oct 19 '15 08:10 aborjinik

Hi v-schulz,

You are right the current JSDoc is not aligned with the code on this particular place. The JSDoc you pointed out is valid for Instant Upload scenario. The sample application you mentioned demonstrates Pending Upload scenario. We're going to align the JSDoc with the code.

Best Regards, Petr Stribrny

StribrnyPetr avatar Oct 19 '15 20:10 StribrnyPetr

Thank you for your reply. Is there any chance to get an event in case the file is delted from the list in the pending state? In my opinion that makes sense because otherwise one can only deal with the situation when a file is added (change-event). If one is deleted, this is not considered.

For example I have a button that is activated in case there are >0 files added for uploading. If I delete all files from the list the button cannot be deactivated because there is currently no event that I can listen to with the enable/disable method. There can be other things to deal with in this situation, too.

v-schulz avatar Oct 19 '15 20:10 v-schulz

Hi, Thank you for the reply. Yes, we are aware of that situation and we are currently in discussion with interaction designer. I'll provide you with the results as soon as known. Regards, Petr

StribrnyPetr avatar Oct 20 '15 06:10 StribrnyPetr

Hi, With the current status of development you should be able to get number of files in the list if you call getItems (i.e. members of the aggregation items). No event delete is necessary. The JSDoc has been updated, the internal incident has status Solution Provided. Regards, Petr

StribrnyPetr avatar Nov 05 '15 15:11 StribrnyPetr