mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Alex/fixforqueryrefresh (#9032)
* added some checks * Added return undefined * added handling for multiple loads * added more error handling * minor space change * added explanation message * simplification * added changes from create new row * added some checks * Added return undefined * added handling for multiple loads * added more error handling * minor space change * added explanation message * simplification * editDataGridPanel corrected * updated to most recent master version * removed space at end * added newline * added another try catch * changed message * added check and message * added clarifying message * removed redundant try catch loop * grid data is now backed up * wording change
This commit is contained in:
@@ -54,6 +54,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
//main dataset to work on.
|
||||
private dataSet: IGridDataSet;
|
||||
private oldDataRows: VirtualizedCollection<any>;
|
||||
private oldGridData: {}[];
|
||||
private firstRender = true;
|
||||
private firstLoad = true;
|
||||
private enableEditing = true;
|
||||
@@ -158,6 +159,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
handleStart(self: EditDataGridPanel, event: any): void {
|
||||
self.dataSet = undefined;
|
||||
self.oldDataRows = undefined;
|
||||
self.oldGridData = undefined;
|
||||
self.placeHolderDataSets = [];
|
||||
self.renderedDataSets = self.placeHolderDataSets;
|
||||
|
||||
@@ -220,6 +222,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
// Setup a function for generating a promise to lookup result subsets
|
||||
this.loadDataFunction = (offset: number, count: number): Promise<{}[]> => {
|
||||
return self.dataService.getEditRows(offset, count).then(result => {
|
||||
if (this.dataSet) {
|
||||
let gridData = result.subset.map(r => {
|
||||
let dataWithSchema = {};
|
||||
// skip the first column since its a number column
|
||||
@@ -242,8 +245,15 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
return p;
|
||||
}, {}));
|
||||
}
|
||||
|
||||
if (gridData && gridData !== this.oldGridData) {
|
||||
this.oldGridData = gridData;
|
||||
}
|
||||
return gridData;
|
||||
}
|
||||
else {
|
||||
this.logService.error('Grid data is nonexistent, using last known good grid');
|
||||
return this.oldGridData;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -431,17 +441,22 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
clearTimeout(this.refreshGridTimeoutHandle);
|
||||
|
||||
this.refreshGridTimeoutHandle = setTimeout(() => {
|
||||
|
||||
try {
|
||||
if (this.dataSet) {
|
||||
this.placeHolderDataSets[0].dataRows = this.dataSet.dataRows;
|
||||
this.onResize();
|
||||
}
|
||||
|
||||
|
||||
if (this.oldDataRows !== this.placeHolderDataSets[0].dataRows) {
|
||||
if (this.placeHolderDataSets[0].dataRows && this.oldDataRows !== this.placeHolderDataSets[0].dataRows) {
|
||||
this.detectChange();
|
||||
this.oldDataRows = this.placeHolderDataSets[0].dataRows;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
this.logService.error('data set is empty, refresh cancelled.');
|
||||
reject();
|
||||
}
|
||||
|
||||
if (this.firstRender) {
|
||||
setTimeout(() => this.setActive());
|
||||
@@ -583,8 +598,11 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
// Checks if input row is our NULL new row
|
||||
private isNullRow(row: number): boolean {
|
||||
// Null row is always at index (totalRows - 1)
|
||||
if (this.dataSet) {
|
||||
return (row === this.dataSet.totalRows - 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Adds CSS classes to slickgrid cells to indicate a dirty state
|
||||
private setCellDirtyState(row: number, column: number, dirtyState: boolean): void {
|
||||
|
||||
Reference in New Issue
Block a user