-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am getting an arralist of byte[] from DB , i want to enlist those file names on the view (byte[] converted to AMedia) . And a click on any of the listed file name should download it.
Hi abhi3q,
If you have a collection of byte[], you can just use FileDownload.save(...) to trigger a download. You just need to register a listener or a command to trigger it.
Make a ListModel of your own object containing the file name and the byte[] content. Use either children binding or ZK8 forEach shadow elements to instantiate a "click here to download" template using that ListModel. Register a click listener or a command onClick (depending on whether you are using MVC or MVVM). When you receive the click event, retrieve the data (listener) or pass the target object as parameter (command), then use FileDownload.save(...) to pass your byte[] content to download. https://www.zkoss.org/wiki/ZKComponentReference/Essential_Components/Filedownload
Asked: 2017-09-22 20:08:46 +0800
Seen: 17 times
Last updated: Oct 12 '17