Copy only text data in DataTable cell
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
[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.
When calling the toClipboard function, it would be good to get an argument and remove the html tag using the regex.
- To use a
DataTablewith ancopyOnlyTextargument
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with components/dash-table/src/dash-table/utils/TableClipboardHelper.ts, especially the toClipboard call referenced in the issue, and trace how DataTable properties reach clipboard handling. Confirm the desired behavior for markdown cells and whether the option is exposed through the Python DataTable API. Done means copying a cell produces only its text rather than rendered HTML when the option is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- data-visualization, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100