Closed Stan92 closed 6 years ago
I think you need to ask that from the Dropzone users / developer in its issues / forums etc. I am not expert how the Dropzone works, this wrapper does not do anything outside of the normal Dropzone operation so how Dropzone handles reset is about its usage and not about this wrapper. I would also expect the reset to clear everything, but maybe some event emit is missing or something else that would make Dropzone know about the mock file.
Using the original library with jQuery it works as expected (However I ll check if I use the same version) I thank you anyway for your reply
But what do you call to reset the Dropzone with jQuery? The reset function is a helper function of this library that calls removeAllFiles. Maybe you need to call it reset(true) which also cancels that uploads and removes those as well. So your mock file might be a such file that Dropzone thinks its not finished uploading.
Just by calling removeAllfiles() It removes all the mock files from the dropzone area as well as the files I’ve uploaded With the wrapper my mock files are displayed well inside the dropzone area but if I call the reset and/or the removeAllfiles functions they are still present in the area even It’s in my point of view a matter of UI like if the dom is not updated
At least there is no way that this library or Angular should be able to effect the way how Dropzone updates DOM (afaik). So most likely something has changed in Dropzone.
Ok, I got it... I have to add a timer. In fact my DZ wrapper is used inside a modal. When the modal is opened at the first time, I have the issue.
This is what I did and seems to be ok
this.smModal.show();
if (!this.isLoaded) {
setTimeout(x => {
this.loadMock(item)
}, 400);
} else {
this.loadMock(item)
}
and
loadMock(item: FileItem) {
this.isLoaded = true;
const dz = this.componentRef.directiveRef.dropzone();
const mockFile = {
name: item.fileName,
size: item.poids,
accepted: true
};
if (dz.files.length > 0) {
dz.removeAllFiles();
}
dz.files.push(mockFile);
dz.emit('addedfile', mockFile);
dz.emit('complete', mockFile);
}
I thank you once again for the support..
Hi, I have some troubles using the reset function while I have existing files.
Let's say I have this context (my intial view) :
I can't see the file using the default template of the component.
I have set a button that runs the reset method but the dropzone area is not reset.
If I upload a file without the "mock" part, and reset the dropzone, it works. No idea?