From dede5c5ef5ac4d80a0ed7bd8ee1deb165fc27f0c Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 14 Sep 2018 21:19:56 -0700 Subject: [PATCH] edit data issue with column index handling (#2595) --- .../grid/views/editData/editData.component.ts | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/sql/parts/grid/views/editData/editData.component.ts b/src/sql/parts/grid/views/editData/editData.component.ts index 6560c1b0ee..22035694e3 100644 --- a/src/sql/parts/grid/views/editData/editData.component.ts +++ b/src/sql/parts/grid/views/editData/editData.component.ts @@ -166,7 +166,7 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On this.onCellEditEnd = (event: Slick.OnCellChangeEventArgs): void => { // Store the value that was set - self.currentEditCellValue = event.item[event.cell - 1]; + self.currentEditCellValue = event.item[event.cell]; }; this.overrideCellFn = (rowNumber, columnId, value?, data?): string => { @@ -270,18 +270,18 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On return self.dataService.updateCell(sessionRowId, self.currentCell.column - 1, self.currentEditCellValue) .then( - result => { - // Cell update was successful, update the flags - self.currentEditCellValue = null; - self.setCellDirtyState(row, self.currentCell.column, result.cell.isDirty); - self.setRowDirtyState(row, result.isRowDirty); - return Promise.resolve(); - }, - error => { - // Cell update failed, jump back to the last cell we were on - self.focusCell(self.currentCell.row, self.currentCell.column, true); - return Promise.reject(null); - } + result => { + // Cell update was successful, update the flags + self.currentEditCellValue = null; + self.setCellDirtyState(row, self.currentCell.column, result.cell.isDirty); + self.setRowDirtyState(row, result.isRowDirty); + return Promise.resolve(); + }, + error => { + // Cell update failed, jump back to the last cell we were on + self.focusCell(self.currentCell.row, self.currentCell.column, true); + return Promise.reject(null); + } ); }); } @@ -377,10 +377,11 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On index => { return {}; } ), columnDefinitions: [rowNumberColumn.getColumnDefinition()].concat(resultSet.columnInfo.map((c, i) => { + let columnIndex = (i + 1).toString(); return { - id: i.toString(), + id: columnIndex, name: escape(c.columnName), - field: i.toString(), + field: columnIndex, formatter: Services.textFormatter, isEditable: c.isUpdatable };