I have a dropzone where imagescan be uploaded. After uploading the images, they are also inserted in the database. When the dialog is opened again, it has to load the images from the database and load them in the dropzone.
Currently, I have this:
var myDropzone = Dropzone.forElement("#file_uploader");
if (data.image)
{
var mockFile = {
name: 'dds',
size: 12345,
type: 'image/' + data.extension,
status: Dropzone.ADDED,
};
// Call the default addedfile event handler
myDropzone.emit("addedfile", mockFile);
// And optionally show the thumbnail of the file:
myDropzone.emit("thumbnail", mockFile, 'images/' + data.image);
myDropzone.files.push(mockFile);
$('file_uploader').find('.dz-message').find('SPAN').css('display', 'hidden');
This was just for test (hence the reason why size and name aren't from the loaded image). But when I click 'Remove file', it doesn't fire an event.
In my function which creates the dropzones, it clearly has:
this.on('removedfile', function (file) {...});
And if I upload a new image, the remove file does fire the event. In the event I do an AJAX request which isn't made when I pre-load the images.
I have no clue what's wrong.