mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Create new row upon focus on last row (#9046)
* enableaddrow now set to true * restore false * null row test * temporary revert * removed unnecessary refresh submitCurrentCellChange
This commit is contained in:
@@ -291,6 +291,11 @@ export class EditDataGridPanel extends GridParentComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isNullRow(row)) {
|
||||||
|
self.addRow(row);
|
||||||
|
self.refreshGrid();
|
||||||
|
}
|
||||||
|
|
||||||
let cellSelectTasks: Promise<void> = this.submitCurrentCellChange(
|
let cellSelectTasks: Promise<void> = this.submitCurrentCellChange(
|
||||||
(result: EditUpdateCellResult) => {
|
(result: EditUpdateCellResult) => {
|
||||||
// Cell update was successful, update the flags
|
// Cell update was successful, update the flags
|
||||||
@@ -543,15 +548,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
|||||||
private submitCurrentCellChange(resultHandler, errorHandler): Promise<void> {
|
private submitCurrentCellChange(resultHandler, errorHandler): Promise<void> {
|
||||||
let self = this;
|
let self = this;
|
||||||
let updateCellPromise: Promise<void> = Promise.resolve();
|
let updateCellPromise: Promise<void> = Promise.resolve();
|
||||||
let refreshGrid = false;
|
|
||||||
if (this.currentCell && this.currentCell.isEditable && this.currentEditCellValue !== undefined && !this.removingNewRow) {
|
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
|
// We're exiting a read/write cell after having changed the value, update the cell value in the service
|
||||||
updateCellPromise = updateCellPromise.then(() => {
|
updateCellPromise = updateCellPromise.then(() => {
|
||||||
// Use the mapped row ID if we're on that row
|
// Use the mapped row ID if we're on that row
|
||||||
@@ -564,9 +561,6 @@ export class EditDataGridPanel extends GridParentComponent {
|
|||||||
result => {
|
result => {
|
||||||
self.currentEditCellValue = undefined;
|
self.currentEditCellValue = undefined;
|
||||||
let refreshPromise: Thenable<void> = Promise.resolve();
|
let refreshPromise: Thenable<void> = Promise.resolve();
|
||||||
if (refreshGrid) {
|
|
||||||
refreshPromise = self.refreshGrid();
|
|
||||||
}
|
|
||||||
return refreshPromise.then(() => {
|
return refreshPromise.then(() => {
|
||||||
return resultHandler(result);
|
return resultHandler(result);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user