Skip to content

Commit

Permalink
Keep track of focused editor cell so it persists after autosave
Browse files Browse the repository at this point in the history
Editor cells using 'dgrid-cellfocusin' trigger an edit of the newly focused
cell followed by a row save (if autosave is true). The save process destroys
the row, updates the data, and re-renders the row. The result is that the
newly rendered row is no longer focused. This PR keeps track of the focused
editor cell during the edit process so that when the save triggers a re-render
the editor is correctly re-activated and focused.

Fixes dojo#1298
  • Loading branch information
msssk committed Mar 3, 2020
1 parent 2ebf9b7 commit f0615a0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ define([

if (previouslyFocusedCell && previouslyFocusedCell.row.id === row.id) {
this.edit(this.cell(row, previouslyFocusedCell.column.id));
this._previouslyFocusedEditorCell = null;
}
return rowElement;
},
Expand Down Expand Up @@ -283,6 +284,7 @@ define([
return null;
}

this._previouslyFocusedEditorCell = cell;
column = cell.column;
field = column.field;
cellElement = cell.element.contents || cell.element;
Expand Down

0 comments on commit f0615a0

Please sign in to comment.