Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Clipboard
Hello all,
Is there a way to copy the content of a grid to the clipboard. With the ClipBoardButton add-on it is possible, but I do not want to have an separate button. I use the GridContextMenu add-on to get the right-click and will add an MenuItem to it.
I also tried to execute java script directly but unfortunately it will not work: http://codetheory.in/javascript-copy-to-clipboard-without-flash-using-cut-and-copy-commands-with-document-execcommand/
Thanks for your help!
Regards,
Thomas
Clipboard has different restrictions depending on browser. With Chrome you need to have corresponding originating event, which makes it tricky and you need to do it with client side extension. If you want to have it in ContextMenu, you need to extend context menu in client side in similar fasion as CliBoardButton does and use that javascript library in somewhat similar fashion. It may required some trial and error to get it working. If you need to support only IE, it will be on the other hand super easy, since you can execture javascript command thru server side JavaScript. IE doesn't require clipboard access to be coupled with event.