Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing any existing file from Dropzone shows dictDefaultMessage

I've created a dropzone showing existing files on the server. I've added remove links which work. My problem is that when I remove a file with its remove link, the default "Drop files here to upload" message appears in the dropzone even though there are still thumbnails remaining.

I've followed this tutorial and updated with

myDropzone.emit("addedfile", mockFile);

// And optionally show the thumbnail of the file:
myDropzone.emit("thumbnail", mockFile, "/image/url");

// Make sure that there is no progress bar, etc...
myDropzone.emit("complete", mockFile);

from Enyo's FAQ.

Why would this be happening?

On a dropzone with no existing files, this message only appears when the last file is removed.

All help appreciated.

Cheers,

Tane

like image 344
TaneBear Avatar asked Oct 20 '25 08:10

TaneBear


1 Answers

Ok I've figured it out, no need to add code to manually change class names. Just add this when you're adding your mockfiles.

mydropzone.files.push(mockFile);

This files array is what dropzone is using to determine if the dropzone is empty or not. And when I was just changing the length property, code was crashing trying to access an array that was never filled.

like image 142
Alex Avatar answered Oct 21 '25 23:10

Alex