简体   繁体   中英

How can I attach a fileDownloader to a button renderer in Vaadin 7 framework

I am using a grid in vaadin 7. Each row contains data about an object. One cell contains a file name. I want to put a download button in each row that causes the associated file to be downloaded.

Grids are supposed to be used with ButtonRenderers, rather than buttons. I have used vaadin.server.FileDownloader before, but always with an actual button rather than a renderer. When using a button you connect the button to the downloader using

downloader.extend(button);

But I can't see how to do it using a ButtonRenderer. Any help is greatly appreciated.

You are missunderstanding the purpose of ButtonRenderers.

You actually add Button to Grid and then, put a ButtonRenderer in that column, so you can use the button as usually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM