perspective icon indicating copy to clipboard operation
perspective copied to clipboard

Example of how to enable copy from table cell

Open paddymul opened this issue 1 year ago • 4 comments

Feature Request

I want to be able to copy cell values from the table to the clipboard.

Description of Problem:

I want to be able to use the perspective table like any other table, including copying values out of a table. This is somewhat possible with the current implementation if you make cells edittable.

Potential Solutions:

Context menu, or click cell to highlight, then Ctrl-C copies the value to the clipboard.

paddymul avatar Sep 24 '24 20:09 paddymul

Surprisingly this is an enterprise only feature for ag-grid. https://www.ag-grid.com/javascript-data-grid/clipboard/

paddymul avatar Sep 24 '24 20:09 paddymul

You can use the "Select Region" mode to select single cells (or regions obv), which are then copyable in the "Copy" menu:

https://github.com/user-attachments/assets/8f850a82-1848-4971-b844-39fd8bb74c56

This could be more elegant:

  • [ ] You are still limited to existing perspective output types e.g. csv, we can add a truly-single-cell and properly formatted (e.g. significant digits or datetime format) special case for when region selection is a single cell.
  • [ ] Ctrl-C is not enabled by default. We could add a handler for this but it may behave quirkily in your web app due to browser focus rules (e.g. I expect this not to work great in Jupyter). Need to do some research.
  • [ ] '"Region Select"should be default instead ofRead-Only` maybe? I'm open to ideas about hwo to make selection modes more discoverable.

texodus avatar Sep 26 '24 00:09 texodus

I'm open to ideas about hwo to make selection modes more discoverable.

HTML table's native text selection mode is the most discoverable, since perspective data-grid renders an html table why doesn't native text selection work, can it be the default mode if other options need to exist?

aszenz avatar Mar 11 '25 21:03 aszenz

EDIT:

Seems like text selection does work in edit mode but only for a single cell, one cannot copy across cells (both horizontally/vertically) like in a normal HTML table:

A B C
1 hello bye
1 long string of the text bye
1 another text string bye

aszenz avatar Mar 11 '25 21:03 aszenz