plotly / plotly/dash

Dash DataTable data and data_previous are the same when value is changed via paste (CTRL + V)

Open
#1,880 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug dash-data-table P3
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.