From 15e592647e51fa6b9f40545afbe8faf439324e6a Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Mon, 20 Apr 2020 14:26:17 -0700 Subject: [PATCH] Revert "Create new row upon focus on last row (#9046)" (#10039) This reverts commit 6b9184aa15ff7b631ae984ddf9163d486aedf0fc. --- .../editData/browser/editDataGridPanel.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/sql/workbench/contrib/editData/browser/editDataGridPanel.ts b/src/sql/workbench/contrib/editData/browser/editDataGridPanel.ts index e3d430ac381..cdcd337bd55 100644 --- a/src/sql/workbench/contrib/editData/browser/editDataGridPanel.ts +++ b/src/sql/workbench/contrib/editData/browser/editDataGridPanel.ts @@ -292,11 +292,6 @@ export class EditDataGridPanel extends GridParentComponent { return; } - if (this.isNullRow(row)) { - self.addRow(row); - self.refreshGrid(); - } - let cellSelectTasks: Promise = this.submitCurrentCellChange( (result: EditUpdateCellResult) => { // Cell update was successful, update the flags @@ -549,7 +544,15 @@ export class EditDataGridPanel extends GridParentComponent { private submitCurrentCellChange(resultHandler, errorHandler): Promise { let self = this; let updateCellPromise: Promise = Promise.resolve(); + let refreshGrid = false; if (this.currentCell && this.currentCell.isEditable && this.currentEditCellValue !== undefined && !this.removingNewRow) { + if (this.isNullRow(this.currentCell.row)) { + refreshGrid = true; + // We've entered the "new row", so we need to add a row and jump to it + updateCellPromise = updateCellPromise.then(() => { + return self.addRow(this.currentCell.row); + }); + } // We're exiting a read/write cell after having changed the value, update the cell value in the service updateCellPromise = updateCellPromise.then(() => { // Use the mapped row ID if we're on that row @@ -562,6 +565,9 @@ export class EditDataGridPanel extends GridParentComponent { result => { self.currentEditCellValue = undefined; let refreshPromise: Thenable = Promise.resolve(); + if (refreshGrid) { + refreshPromise = self.refreshGrid(); + } return refreshPromise.then(() => { return resultHandler(result); });