Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 03dfc7f

Browse files
Issue 583 - Edit cell with scrolled virtualized view (#584)
1 parent 00e25de commit 03dfc7f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1414
[#18](https://github.com/plotly/dash-table/issues/18)
1515
- Fix row selection vertical and horizontal alignment
1616

17+
[#583](https://github.com/plotly/dash-table/issues/583)
18+
- Fix regression when editing the content of a cell in a scrolled virtualized table
19+
1720
### Added
1821
[#319](https://github.com/plotly/dash-table/issues/319)
1922
- New 'loading_state' prop that contains information about which prop, if any, is being computed.

src/dash-table/handlers/cellEvents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const handleChange = (propsFn: () => ICellFactoryProps, idx: number, i: n
121121
} = propsFn();
122122

123123
const c = visibleColumns[i];
124-
const realIdx = virtualized.indices[idx];
124+
const realIdx = virtualized.indices[idx - virtualized.offset.rows];
125125

126126
if (!c.editable) {
127127
return;
@@ -152,7 +152,7 @@ export const handleEnter = (propsFn: () => ICellFactoryProps, idx: number, i: nu
152152
} = propsFn();
153153

154154
const c = visibleColumns[i];
155-
const realIdx = virtualized.indices[idx];
155+
const realIdx = virtualized.indices[idx - virtualized.offset.rows];
156156

157157
setState({
158158
currentTooltip: {
@@ -179,7 +179,7 @@ export const handleMove = (propsFn: () => ICellFactoryProps, idx: number, i: num
179179
} = propsFn();
180180

181181
const c = visibleColumns[i];
182-
const realIdx = virtualized.indices[idx];
182+
const realIdx = virtualized.indices[idx - virtualized.offset.rows];
183183

184184
if (currentTooltip && currentTooltip.id === c.id && currentTooltip.row === realIdx) {
185185
return;

tests/cypress/tests/standalone/scrolling_test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ variants.forEach(([mode, flavors]) => {
5050

5151
cy.get('.row-1').scrollTo(0, 0);
5252
DashTable.getSelectedCells().should('have.length', 6);
53+
});
54+
55+
it('can edit cell', () => {
56+
DashTable.toggleScroll(false);
57+
DashTable.getCell(0, 0).click();
58+
DashTable.toggleScroll(true);
59+
60+
cy.get('.row-1').scrollTo(0, 1000);
61+
cy.wait(1000);
62+
63+
DashTable.getCell(10, 1).click();
64+
DOM.focused.type(`Edited${Key.Enter}`);
5365

66+
DOM.focused.type(`${Key.ArrowUp}`);
67+
DOM.focused.should('have.value', 'Edited');
5468
});
5569
});
5670
});

0 commit comments

Comments
 (0)