allow deselect active_cell in datatable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Is your proposal related to a problem?
The dash datatable supports to select and highlight a cell. However, deselecting an active cell is not possible, as clicking on an already active cell is ignored:
https://github.com/plotly/dash/blob/6cfb7874800152794d8d603e8d9c4334bf61e3fd/components/dash-table/src/dash-table/handlers/cellEvents.ts#L31-L34
Describe the solution you'd like
In my use case, I need to update other components based on the selected cells in the table. Having none of the cells selected is a valid option, as it is the natural situation before having selected any cell on startup. Therefore, I would like to receive an event when an active cell is "deselected".
I understand, that not all the use cases would like to have this behaviour. Therefore, one could introduce a new property like cell_deselectable which would propagate that event.
Describe alternatives you've considered
Instead of just selecting a cell, in my use case, where I am interested in row selection, I could workaround using the row_selectable flag. However, the extra column for the checkbox is wasting space and does not feel good, if one could just click any cell of the row to select the row.
Other workarounds were provided here, but add a lot of extra code for this simple feature:
https://community.plotly.com/t/unselect-active-cell-datatable/43124
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 in components/dash-table/src/dash-table/handlers/cellEvents.ts at the linked lines, then trace how active-cell changes are exposed to Dash. Determine the behavior and configuration needed for clicking the active cell to produce a deselection event, and verify that consumers can observe a state with no selected cell.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python, react
- Domain
- data-visualization, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100