dash icon indicating copy to clipboard operation
dash copied to clipboard

[Feature Request] Copy only text data in DataTable cell

Open alstn2468 opened this issue 3 years ago • 0 comments

[Feature Request] Copy only text data in DataTable cell

Current

  • html tag of table to be copied
<td
  tabindex="-1"
  class="dash-cell column-13 cell--selected focused"
  data-dash-column="some column"
  data-dash-row="0"
>
  <div class="input-active unfocused dash-cell-value cell-markdown">
    <div class="center">
      0
    </div>
  </div>
</td>
  • Copied Results
<div class='center'>0</div>

Solution

Add parameter such as copyOnlyText that only text data are copied. Or, it would be good to apply it when the presentation of the cell is markdown.

TableClipboardHelper.ts#L21

When calling the toClipboard function, it would be good to get an argument and remove the html tag using the regex.

  • To use a DataTable with an copyOnlyText argument
DataTable(
  df.to_dict('records'),
  [{"name": i, "id": i, presentation="markdown"} for i in df.columns],
  id='tbl',
  copyOnlyText=True,
)

If the html like the above behavior is rendered, if the copyOnlyText argument is passed, it seems that only 0 should be copied.

alstn2468 avatar Sep 14 '22 07:09 alstn2468