Vitalii.1
(Vitalii Lipovetskii)
1
Usual button, which is added to form layout occupies the entire form layout cell.
Button, that is placed inside Anchor (see beloe) is not.
https://vaadin.com/forum/thread/17010389/17303946
Anchor download = new Anchor(new StreamResource("filename.ext", () -> createResource()), "");
download.getElement().setAttribute("download", true);
download.add(new Button(new Icon(VaadinIcon.DOWNLOAD_ALT)));
How to force fix it ?
Maurice19
(Maurice Pochzosz)
2
I know it´s old but for anyone else stumbling on it from google:
It worked for me when i did a removeAll() on the Anchor first.
Using the Example above, this should do the Trick.
Anchor download = new Anchor(new StreamResource("filename.ext", () -> createResource()), "");
download.getElement().setAttribute("download", true);
download.removeAll();
download.add(new Button(new Icon(VaadinIcon.DOWNLOAD_ALT)));
1 Like