Search code examples
javascriptjqueryfine-uploader

Fine Uploader. cancelAll is not a function within onComplate call back. Why?


This is my onComplete.

$('#fine-uploader-house').fineUploader({
...
}).on('complete', function(event, id, name, json) {
    if(!blank(json.cancelAll) && json.cancelAll){
        //$('#fine-uploader-<?=$data['type'];?>').cancelAll();
        //$(this).cancelAll();
        document.getElementById('fine-uploader-<?=$data['type'];?>').cancelAll( );
    }
});

I've try to run the cancelAll( ) function multiple ways but always get the same error message.

[FineUploader 3.7.0] Caught exception in 'onComplete' callback - document.getElementById(...).cancelAll is not a function http://ahm.localhost/jquery.fineuploader-3.7.0/jquery.fineuploader-3.7.0.min.js Line 16

I cannot seem to find any other information on this and I cannot determine where the fault lies. Other than this the uploader is working without any issues.

Any ideas?


Solution

  • The typical way to call methods on a jQuery plug-in is by passing the name of the method into the plug-in's associated jQuery function. For example:

    $('#someDiv').somePlugin('someMethod', somearg1, somearg2);  
    

    Fine Uploader is no different. In this case, you would call cancelAll like this:

    $(this).fineUploader('cancelAll');   
    

    This is all covered in the jQuery plug-in section of Fine Uploader's documentation as well.