openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

sap.m.UploadCollection fileDeleted event callback not executing

Open luciencooper opened this issue 10 years ago • 8 comments

OpenUI5 version: 1.40.6

Browser/version (+device/version): Chrome/52.0.2743.116

Any other tested browsers/devices(OK/FAIL): IE (FAIL)

URL (minimal example if possible): https://openui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.UploadCollectionForPendingUpload/preview

Steps to reproduce the problem:

  1. Add file using "+" button
  2. Delete file using "x" button
  3. Callback function registered to fileDeleted event does not execute
  4. Appears to fail when instantUpload="false"

What is the expected result? The event is fired regardless of whether instantUpload is true/false and the callback function (if one is given) should be executed

What happens instead? The item is removed from the list (not the model, guessing developer has to take care of this) but the callback is not executed.

luciencooper avatar Sep 20 '16 12:09 luciencooper

Hi,

this might have been implemented intentionally in the code the instantUpload is explicitly checked here

Tracked it down to this commit but there is no explaination... 34641c0ec8a9521100d0e020aa5ce4366d3954b2

I will ask the Control owners to shed some light here. Tracked 1670431425.

Best regards, Tobias

ghost avatar Sep 21 '16 07:09 ghost

I also thought it might be intentional. However, if the user deletes a document from the list, how does the developer update the model?

luciencooper avatar Sep 21 '16 08:09 luciencooper

Yes you need the event. That's why i put the bug label.

ghost avatar Sep 21 '16 08:09 ghost

Hello Lucien,

I suppose this is a misunderstanding the scenario. As supposed by Tobias, that has been implemented intentionally – in case of the Upload Pending scenario the files selected for the upload are collected within a temporary list of files. The user can add/remove files from this list, whereby for to add a file the icon “plus” is used and for to remove a file the icon “delete” is used. Please be informed, what you describe is not a delete file function, but something like “remove a file from the list of files to be uploaded”. Up to now, there has been requirement to inform the application a file for upload has been added/removed, therefore there is no event triggered by the control. Please describe your business scenario why you need the mentioned event in this particular case. Thank you.

StribrnyPetr avatar Sep 21 '16 13:09 StribrnyPetr

Thanks for the response. I have two UploadCollection controls bound to the same aggregation in my model "filesForUpload". On the first screen, the user can add documents to the UploadCollection control but they are not uploaded yet. On the second screen I wish to show the same list of documents but with the "+" button disabled, to serve as a review of what will be uploaded once they click submit. If the user wishes to delete a document from the list, I have an inconsistency where for one UploadCollection the file is gone, and in another it is still present as I have not been able to remove it from the "filesForUpload" property.

luciencooper avatar Sep 21 '16 14:09 luciencooper

Thanks for the update. We've debugged some samples with Tobias and clarified the behavior. The described scenario is currently not supported => label changed to enhancement. We'll consider the requirement and I'll update the ticket.

StribrnyPetr avatar Sep 21 '16 15:09 StribrnyPetr

Hi Lucien,

to get you a solution since the items aggregation with the pending upload seems not to be designed for databinding, how about using the clone method of the file uploader and clone the Uploader and put it to the correct place. If a user goes back you probably need to clone again. For the timings you could use the onBeforeShow of the navContainer

Hope this can get you somewhere - just an idea. If it does not work for you the only way i see is overwriting the removeItem function (with safely applying the original) of your file uploader instance to get a delete notification.

Of course both suggestions are workarounds

ghost avatar Sep 21 '16 21:09 ghost

Hi Lucien,

As mentioned earler, the required business scenario is not supported by the UploadCollection control yet. Your requirement has been addressed to the product owner of the UploadCollection control and will be considered within the next backlog items planning. Thank you for your contribution.

Best Regards, Petr

StribrnyPetr avatar Oct 04 '16 14:10 StribrnyPetr