DataTable is not able to remove displayed row when just added
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Context
dash 1.15.0
dash-core-components 1.11.0
dash-extensions 0.0.31
dash-html-components 1.1.0
dash-renderer 1.7.0
dash-table 4.10.0
Describe the bug
I am using two Dash DataTables which one act as a table (say A) of selected and the other (say B) of unselected items. I can remove (via built in DataTable remove functionality) one item in the first DataTable A and it gets added to the DataTable B (via a callback), and vice versa. The problem is when I remove an item on the first DataTable A and then do the same on DataTable B the item appears again on DataTable A. In this case, the item seems to be in DataTable A, but an additional remove does not trigger the call back to move it to DataTable B. It seems like the item is not really register for the remove functionality although it appears on DataTable A. This time, the click on remove does not start e network request at all (usually there is one).
Interestingly, if I remove different items on either DataTable it does not break.
The setup looks like this:
@app.callback(Output('intermediate-value', 'children'),
[Input('selected-title-table', 'data_previous'),
Input('unselected-title-table', 'data_previous')],
[State('intermediate-value', 'children'),
State('selected-title-table', 'data'),
State('unselected-title-table', 'data')])
def callbackHandle(selected_previous_rows, unselected_previous_rows, intermediate_values, selected_current_rows, unselected_current_rows):
The data_previous prop detects the remove action of the DataTable and together with the State of data prop I can calculate which item was removed in the DataTable. Afterwards I write the new lists (selected and unselected) to the 'intermediate-value' div as a sharing state (recommended in the dash docs).
Then there comes a callback on these intermediate-values to fill the data into the DataTables again:
# Fill tables with titles
@app.callback([Output('selected-title-table', 'data'),
Output('unselected-title-table', 'data'))],
Input('intermediate-value', 'children'))
def updateDataTables(intermediate_values):
Expected behaviour
I would expect that the remove functionality of DataTable works on all appearing items of the DataTable.
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
Reproduce the issue with two DataTables using the shown data_previous and data callbacks, moving the same item between tables. Start by tracing how repeated removals and refreshed data are handled, then verify that every displayed item remains removable and that the second removal triggers a network request and callback.
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
- 35/100