View Full Version : How To Copy Rows From Grid?

13 Jun 2007, 5:49 AM
How do you perform a basic copy of rows from a grid? For example, I have a paging grid loaded and have singleSelect = false. The user is able to select multiple rows using the shift key, but there isn't an option to copy in your mouse's right click menu.

I need to be able to copy 1 or multiple rows of data from a grid and paste them into excel.

Is this possible?

15 Jun 2007, 7:07 AM
I think you'd have to implement the copy function yourself. I don't know the final call that would put the text in the clipboard though...
You could have right-click menu with 'Copy' option (or a key-listener for Ctrl+C) to call a function. That function would have to iterate through the selected rows and pull the information out of the cells (concat into one string). From there you'd have to make a system call of some sort that copies the string to clipboard.
I found a copy-to-clipboard something that supposedly works in IE, but not FF.
More specifically...


15 Jun 2007, 9:09 AM
try this (http://www.jeffothy.com/weblog/clipboard-copy/) x-browser clipboard hack.

15 Jun 2007, 10:59 AM
Above mentioned concepts aren't reliable.
They all depends on browser security settings.
Why not just using default clipboard.

The concept is pretty simple and efficient.
Home page: http://liveclipboard.org
Related article: http://rayozzie.spaces.live.com/blog/cns!FB3017FBB9B2E142!285.entry
Example: http://spaces.live.com/editorial/rayozzie/demo/liveclip/liveclipsample/clipboardexample.html

15 Jun 2007, 9:37 PM
@matjaz, just tried the live clipboard example. it works fine in IE7, but doesn't work properly in FF2.0.0.4.

copying contents from FF2.0.0.4 to IE7 works, but copying contents from one block to another within FF works intermittently.

16 Jun 2007, 1:03 AM
I'm also using FF but haven't experienced any problems.

5 Jul 2007, 5:38 AM
Hey does anyone have an example of Live Clipboard being implemented with a grid? I'm curious to see how it was coded and how some things were implemented from a UI perspective.