Deleting files does work #415

Closed
pna-svd opened this Issue Oct 22, 2012 · 10 comments
@pna-svd

Any try to delete a file did fail.

There appeared an error message in the web developer tools of my browser (I was using chrome at the moment).

Uncaught TypeError: Object # has no method 'isRejected'

In elfinder.full.js (elFinder 2.0 rc1), there was/is a problem in line 1338:

        }), e.isRejected() || (f = this.hashes(b), d.confirm({title:c.title, text:"confirmRm", accept:{label:"btnRm", callback:function () {d.lockfiles({files:f}), d.request({data:{cmd:"rm", targets:f}, notify:{type:"rm", cnt:g}, preventFail:!0}).fail(function (a) {e.reject(a)}).done(function (a) {e.done(a), i && d.exec("open", i)}).always(function () {d.unlockfiles({files:f})})}}, cancel:{label:"btnCancel", callback:function () {e.reject()}}})), e)

I've changed that to

        }), (e.hasOwnProperty('isRejected') && e.isRejected()) || (f = this.hashes(b), d.confirm({title:c.title, text:"confirmRm", accept:{label:"btnRm", callback:function () {d.lockfiles({files:f}), d.request({data:{cmd:"rm", targets:f}, notify:{type:"rm", cnt:g}, preventFail:!0}).fail(function (a) {e.reject(a)}).done(function (a) {e.done(a), i && d.exec("open", i)}).always(function () {d.unlockfiles({files:f})})}}, cancel:{label:"btnCancel", callback:function () {e.reject()}}})), e)

and it's working now.

More clearly I've changed "e.isRejected()" to "(e.hasOwnProperty('isRejected') && e.isRejected())".

I guess the error/warning whatever came, were responsible for the delete function to fail. It would be nice to have a fix/this fix included in the next release version of elFinder.

Kind regards
pna

@damianignacio

I've been getting the same error. I've changed

dfrd.isRejected()

to

dfrd.state() == 'rejected'

and works for me.

Regards

@Denis2222

THANNNNNNNNNNNNNKSSSSSSSSSSSSSSSS !!!!!

:)

:+100000000000000000000000:

@joselfonseca

Awesome FIX! Thank you very much!

@wintercounter

Wrks like a charm! Search replaced all, all file actions now working fine :) Thanks!

@aptik

jQuery API Documentation says:

As of jQuery 1.7 this API has been deprecated; please use deferred.state() instead.

version deprecated: 1.7, removed: 1.8.

I think @damianignacio fix is only way for those who uses jQuery 1.8+.

@aptik aptik pushed a commit that referenced this issue May 17, 2013
Arthur Halma Issue #415: Deleting files does work 44492c0
@mrns

Thanks for the fix...!

@2kCastor

thx damianignacio. u are my hero :)

@karissa karissa pushed a commit to ContinuumIO/elFinder that referenced this issue Oct 24, 2013
Arthur Halma Issue #415: Deleting files does work 1b1f0c6
@ltimsi

thx for the fix

@rafaels88

Thanks a LOT man!! Genius!!

@nao-pon
Studio 42 member

This is already corrected already on 2.x branch.

@nao-pon nao-pon closed this Nov 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment