From 2c7b5578e7a6a35fd707fe83f1a73a717deb20e3 Mon Sep 17 00:00:00 2001 From: udeeshagautam <46980425+udeeshagautam@users.noreply.github.com> Date: Wed, 13 Mar 2019 11:03:41 -0700 Subject: [PATCH] Bug/3731 results scroll (#4408) * Bug 3731: Minor issues saving scroll position in results Fixing the second part i.e. scroll position of results view while switching tabs. The resize call was not respecting the old scrolbar state. Making an explit call to set scroll position to ensure this sets at the end. --- src/sql/parts/query/editor/gridPanel.ts | 4 ++++ src/sql/parts/query/editor/queryResultsView.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/sql/parts/query/editor/gridPanel.ts b/src/sql/parts/query/editor/gridPanel.ts index c80d5cbe47..4a918df878 100644 --- a/src/sql/parts/query/editor/gridPanel.ts +++ b/src/sql/parts/query/editor/gridPanel.ts @@ -202,6 +202,10 @@ export class GridPanel extends ViewletPanel { } } + public resetScrollPosition() : void { + this.splitView.setScrollPosition(this.state.scrollPosition); + } + private onResultSet(resultSet: azdata.ResultSetSummary | azdata.ResultSetSummary[]) { let resultsToAdd: azdata.ResultSetSummary[]; if (!Array.isArray(resultSet)) { diff --git a/src/sql/parts/query/editor/queryResultsView.ts b/src/sql/parts/query/editor/queryResultsView.ts index b90dffadbd..6ca78e392d 100644 --- a/src/sql/parts/query/editor/queryResultsView.ts +++ b/src/sql/parts/query/editor/queryResultsView.ts @@ -108,6 +108,8 @@ class ResultsView extends Disposable implements IPanelView { this.currentDimension = dimension; if (this.needsGridResize) { this.panelViewlet.resizePanel(this.gridPanel, this.state.gridPanelSize || Math.round(this.currentDimension.height * .7)); + // we have the right scroll position saved as part of gridPanel state, use this to re-position scrollbar + this.gridPanel.resetScrollPosition(); } }