Dash DataTable data and data_previous are the same when value is changed via paste (CTRL + V)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Describe your context
dash 2.0.0
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
-
if frontend related, tell us your Browser, Version and OS
- OS: MacOS Big Sur
- Browser: Chrome
- Version 96.0.4664.110
Describe the bug
When the user changes a value in a dash datatable using copy/paste (CTRL + V), data and data_previous are identical, i.e., data_previous is updated to the current value.
Expected behavior
I expect data_previous to be the old value of the cell, in order to make it possible to identify the change.
Minimal Working Example
import dash
from dash.dependencies import Input, Output, State
from dash import dash_table
from dash import html
app = dash.Dash(__name__)
app.layout = html.Div([
dash_table.DataTable(
id='computed-table',
columns=[
{'name': 'Input Data', 'id': 'input-data'},
],
data=[{'input-data': i} for i in range(11)],
editable=True,
),
html.Pre(id="output_div"),
])
@app.callback(
Output('output_div', 'children'),
Input('computed-table', 'data'),
State('computed-table', 'data_previous'),
State('computed-table', 'data_timestamp'))
def update_columns(rows, previous, timestamp):
if previous == rows:
return f"{timestamp} - data and data previous are the same"
else:
return f"{timestamp} - data and data previous are not the same"
if __name__ == '__main__':
app.run_server()
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 the minimal working example in the issue and reproduce the paste operation in Dash DataTable. Trace the callback values for data and data_previous, then verify that data_previous retains the cell's old value after a pasted edit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100