-
1. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
michpetrov Nov 27, 2014 3:52 AM (in response to edilmar)Hi,
the purpose of the fileupload is to send the files to the server. Whatever you want to happen on the server you'll need to implement yourself, e.g. you can change the showcase example so that "Uploaded Files Info" contains a button tied to a delete method.
-
2. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
edilmar Nov 27, 2014 1:30 PM (in response to michpetrov)Hi,
You didn't understand the real problem.
My problem is same that RichFaces 4: FileUpload Clear Event that is not solved yet, there is a JIRA for this to solve in RF5.x ([RF-11746] missing clear handler in FileUpload for individual file removals - JBoss Issue Tracker).
-
3. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
michpetrov Dec 1, 2014 4:00 AM (in response to edilmar)Ah, ok. We do have the listeners, but the docs you're linking are for 4.0.X, the docs for 4.3.X include @onclear.
-
4. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
edilmar Dec 1, 2014 2:38 PM (in response to michpetrov)The problem is that these listeners aren't server side listeners just like fileUploadListener.
This is not the better solution from the API.
-
5. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
michpetrov Dec 2, 2014 6:44 AM (in response to edilmar)No, they aren't server-side, the files are only removed on client side so there is no point telling the server. You can however set an <a4j:ajax> to listen to the "onclear" event and call a server-side method when it triggers.
-
6. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
edilmar Jan 5, 2015 2:35 PM (in response to michpetrov)It would be better that a next version of Richfaces to implement real server-side events for clear and clearAll, for better integration of client and server files, better management, and to write a clear code like fileUploadListener. These ways to create a javascript code to call the server is not the correct solution for this problem. If possible, I would like to create a JIRA to suggest this for next version.
-
7. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
michpetrov Jan 6, 2015 4:14 AM (in response to edilmar)a4j:ajax (or a4j:jsFunction) exist specifically for this kind of use-case.
A listener like this would make sense if the internal state or "value" of the component was changed (the component compares old and new state and fires an event) but the list of uploaded files exists only on the client side, the server part of the component doesn't keep track of the files. Or maybe the other way around - if we implemented the listener what arguments would you expect to be passed to it?
You may of course create a JIRA, there are no requirements for doing that.
-
8. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
edilmar Jan 12, 2015 3:41 PM (in response to michpetrov)Hi,
Thinking these steps:
1) I upload one or more files from my client machine to server => a listener runs to send the files
2) I want to delete one or all files I sent from the server => listeners delete or deleteAll would delete the files from server
This would be a easy way to handle insert/delete of files of the server.
-
9. Re: isn't there listeners for Delete/DeleteAll in rich:fileUpload?
michpetrov Jan 13, 2015 12:21 PM (in response to edilmar)I understand what you want to do. I'm trying to explain to you how listeners works, you need an event to send to the listener. Since the fileUpload component doesn't keep track of the uploaded files it cannot send an event with the name of the file that got deleted. On top of that the list of the uploaded files disappears if you leave or refresh the page, so after that you wouldn't be able to delete the files anyway. (And users won't always want to delete the files from the server).