Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking cancel uploads only removes half of files from queue #7

Open
paradigmbase opened this issue Jan 29, 2014 · 6 comments
Open

Comments

@paradigmbase
Copy link

In my app as well as the demo page, clicking on Cancel Uploads only removes half of the files in the queue.

@paradigmbase
Copy link
Author

For the cancel all handler, a while loop works better then using each.

backbone.upload-manager.js ln 198:

// Add cancel all handler
$('button#cancel-uploads-button', this.el).click(function(){
    while (self.files.length) {
        self.files.at(0).cancel();
    }
});

@Darksoulsong
Copy link

@paradigmbase Nice solution. Thx a lot!

@paradigmbase
Copy link
Author

Np

@dogeared
Copy link
Contributor

dogeared commented Aug 8, 2014

Doesn't look like this solution ever got merged in. The bug persists on the demo page. I will setup a PR for this.

@sroze
Copy link
Owner

sroze commented Aug 8, 2014

@paradigmbase Your code snippet seams to always loop on the first item, as the cancel method on file don't remove it from files collection... Right ?

@paradigmbase
Copy link
Author

It essentially does the same thing as your original code, except that instead of using each it uses a while loop. The each loop didn't allow the cancel method to be called on each model in the collection, but a while loop does.

It does call cancel on the first item of the collection. However, each time the loop iterates this is a new item since the previous first item has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants