Rendering multiple files as labels and download one by one

asked 2017-09-22 20:08:46 +0800

abhi3q gravatar image abhi3q

updated 2017-09-22 20:10:11 +0800

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.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-10-12 17:48:56 +0800

MDuchemin gravatar image MDuchemin
1511 1 5
ZK Team

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

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2017-09-22 20:08:46 +0800

Seen: 17 times

Last updated: Oct 12 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More