PDA

View Full Version : Select/Copy/Paste & Grids



mschwartz
27 Aug 2010, 6:57 AM
My application uses a lot of grids and forms and HTML editors and so on. The end users have recently complained that they can't select/copy/paste test in the grid columns into form fields or HTML editors (the forms/editors in other tabs of a TabPanel), or even notepad.

Their complaint is valid, and I'm wondering if there's anyone else who's had this issue and what the resolution is.

If the text in a grid column is a link (<a href=...whatever>) you can click on the link and it does the right thing. You just can't click to select plain old text in the grid column so you can copy/paste it somewhere else.

Suggestions?

VinylFox
27 Aug 2010, 7:36 AM
Theres all these unselectable="on" attributes on the grid cells, along with styles that re-enforce that. Probably be a huge pain to go through and remove that stuff.

What about adding a right click menu to the grid with a copy option?

mschwartz
27 Aug 2010, 12:01 PM
Theres all these unselectable="on" attributes on the grid cells, along with styles that re-enforce that. Probably be a huge pain to go through and remove that stuff.

What about adding a right click menu to the grid with a copy option?

Copy to my own internal clipboard? Interesting, but it only works within the application.

There's security problems accessing the system clipboard (or the JS could look at private stuff you might have in the clipboard).

jeffcrilly
27 Aug 2010, 8:18 PM
We have enabled copy/paste from grids in our extjs applications. Our customers are used to copy/pasting from html tables, and were thrown a bit when they could not do this with extjs-based UIs. Unfortunately, i'm away from the code right now, so I cannot verify exactly which CSS styles we are setting, but there is a FAQ on the copy/paste topic....

http://www.sencha.com/learn/Ext_FAQ_Grid#How_to_select_text_in_the_grid_.28with_the_mouse.29_so_that_it_can_be_copied_to_the_clipboard

It does work, and is almost perfect. E.g. double click and all that works. there might be a bit of a conflict depending on if you have additional rendering in the grid cells, etc. But if it is straight text, then it just works.

hope this helps.

jeffcrilly
27 Aug 2010, 8:22 PM
Um.. I posted a link to the sencha faq on this, but it got moderated due to the link I suppose.

Upshot is we have copy/paste from grids working our extjs applications. Basically, there is a couple styles you need to set.
We set the style in the renderer for cells, but it can be set "for all grids".
Oh.. additionally we set a style to allow cell wrapping.

I Dont want to punt on the "do a search" response, but it appears I cant post the link, so ...do a search.

-jeff

j-joey
29 Aug 2010, 7:41 AM
you can use actionScript to set clipboard. check system.setClipboard method.

VinylFox
30 Aug 2010, 4:22 AM
This might be of use to anyone wanting to programatically copy to the system clipboard cross-browser.

http://github.com/mojombo/clippy