Skip to content

Commit 1a09d1e

Browse files
authored
refactor: check cell editable on row update (#10699)
1 parent 42432ef commit 1a09d1e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

packages/grid-pro/src/vaadin-grid-pro-inline-editing-mixin.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,10 @@ export const InlineEditingMixin = (superClass) =>
534534
const item = this.__getRowItem(row);
535535
if (this.__edited) {
536536
const { cell, model } = this.__edited;
537-
if (cell.parentNode === row && this.getItemId(model.item) !== this.getItemId(item)) {
537+
if (!this._isCellEditable(cell)) {
538+
// Cell is no longer editable, cancel edit
539+
this._stopEdit(true, true);
540+
} else if (cell.parentNode === row && this.getItemId(model.item) !== this.getItemId(item)) {
538541
this._stopEdit();
539542
}
540543
}
@@ -570,15 +573,7 @@ export const InlineEditingMixin = (superClass) =>
570573
}
571574
// Otherwise, check isCellEditable function
572575
const model = this.__getRowModel(cell.parentElement);
573-
const isEditable = column.isCellEditable(model);
574-
575-
// Cancel editing if the cell is currently edited one and becomes no longer editable
576-
// TODO: should be moved to `__updateRow` when Grid connector is updated to use it.
577-
if (this.__edited && this.__edited.cell === cell && !isEditable) {
578-
this._stopEdit(true, true);
579-
}
580-
581-
return isEditable;
576+
return column.isCellEditable(model);
582577
}
583578

584579
/**

0 commit comments

Comments
 (0)