In Vaadin 14's Uploader, how do I clear the previously uploaded files?

Viewed 47

In Vaadin 14, I've used Vaadin Designer to add an Uploader component. It works fine. However, I don't know how to clear previously uploaded files. I tried:

multiFileMemoryBuffer.getFiles().clear();

but it didn't do anything. Is there a way to clear the previously uploaded files from the Uploader component in Vaadin 14 when the component has been been created with Vaadin Designer?

1 Answers

Yes, use upload.getElement().setPropertyJson("files", Json.createArray()); to clear the visual file representation on the client side. This was improved in V23 where you can just call upload.clearFileList();

Related