Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Callback after bulk delete #3657

Open
rnixx opened this issue Jul 6, 2020 · 1 comment
Open

Callback after bulk delete #3657

rnixx opened this issue Jul 6, 2020 · 1 comment
Labels

Comments

@rnixx
Copy link

rnixx commented Jul 6, 2020

Bulk delete implementation simply looks up delete buttons of selected items in file list and triggers click on them.

https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload-ui.js#L638

Would be great if the delete requests get tracked and an event gets fired after bulk deletion completes.

Usecase is reloading of some parts of the page after bulk delete.

@blueimp
Copy link
Owner

blueimp commented Jul 7, 2020

Hi @rnixx and thanks for your suggestion.

While there is no event for bulk deletion, there are individual events for each file deletion (see UI events):

$('#fileupload')
    .on('fileuploaddestroy', function (e, data) {/* ... */})
    .on('fileuploaddestroyed', function (e, data) {/* ... */})
    .on('fileuploaddestroyfailed', function (e, data) {/* ... */})

If you want to implement a bulk deletion trigger yourself, you could do so by making use of the above events and some shared state to see if any destroy request are in progress, similar to how the start/stop callbacks in the core library are implemented:

if (that._active === 0) {
// The stop callback is triggered when all uploads have
// been completed, equivalent to the global ajaxStop event:
that._trigger('stop');

I'll mark this as a feature request.

@blueimp blueimp added the feature label Jul 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants