PDA

View Full Version : Selectable AdvancedDataGrid text


ScreamingKettle
01-07-2009, 10:18 AM
Hello,
Does anyone know how to make text in a datagrid selectable so that a value can be copied to the clipboard? Setting 'selectable' to 'true' obviously doesn't help; I was hoping there would be a 'selectableText' option.
I thought making the fields editable might be a way to get around it (but got a "TypeError: Error #1010: A term is undefined and has no properties" if I tried :rolleyes:), but I don't really want them to be editable; only selectable.

Cheers for any help

ljuwaidah
01-07-2009, 08:21 PM
I haven't used (Advanced)DataGrid much but one thing I know for sure is that you can use a TextInput as an itemRenderer.

Peter Cowling
01-08-2009, 06:29 PM
Hi,

You would want to use System.setClipboard() .

See here (http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/) for the general approach.

ScreamingKettle
01-12-2009, 09:42 AM
Ah yes, I had used setClipboard for one of my fields as a context menu option. Perhaps I should have a generic "Copy value" as a right-click option for every datagrid cell. It's not the same as the user would be used to (i.e.highlight some text and press Ctrl+C) but it will do.

I might try using a TextInput as an item renderer, but I don't want the text to look like an input field. Also, with many fields on screen I'm worried it might hamper performance.

Thanks to both of you for your advice .

ljuwaidah
01-12-2009, 11:34 AM
I dunno about the performance but if you're worried about the look you can set the border style to solid and its width to 1, that should make it look almost like the normal fields.

PS: Thanks Peter, I didn't know about the clipboard thing.