mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
fix the grid goes blank issue (#20209)
This commit is contained in:
@@ -127,7 +127,7 @@ export class CellSelectionModel<T> implements Slick.SelectionModel<T, Array<Slic
|
|||||||
} else {
|
} else {
|
||||||
ranges = [new Slick.Range(0, columnIndex, this.grid.getDataLength() - 1, columnIndex)];
|
ranges = [new Slick.Range(0, columnIndex, this.grid.getDataLength() - 1, columnIndex)];
|
||||||
}
|
}
|
||||||
this.grid.setActiveCell(0, columnIndex);
|
this.grid.setActiveCell(this.grid.getViewport()?.top ?? 0, columnIndex);
|
||||||
this.setSelectedRanges(ranges);
|
this.setSelectedRanges(ranges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class RowNumberColumn<T> implements Slick.Plugin<T> {
|
|||||||
|
|
||||||
private handleHeaderClick(e: MouseEvent, args: Slick.OnHeaderClickEventArgs<T>): void {
|
private handleHeaderClick(e: MouseEvent, args: Slick.OnHeaderClickEventArgs<T>): void {
|
||||||
if (args.column.id === 'rowNumber') {
|
if (args.column.id === 'rowNumber') {
|
||||||
this.grid.setActiveCell(0, 1);
|
this.grid.setActiveCell(this.grid.getViewport()?.top ?? 0, 1);
|
||||||
let selectionModel = this.grid.getSelectionModel();
|
let selectionModel = this.grid.getSelectionModel();
|
||||||
if (selectionModel) {
|
if (selectionModel) {
|
||||||
selectionModel.setSelectedRanges([new Slick.Range(0, 0, this.grid.getDataLength() - 1, this.grid.getColumns().length - 1)]);
|
selectionModel.setSelectedRanges([new Slick.Range(0, 0, this.grid.getDataLength() - 1, this.grid.getColumns().length - 1)]);
|
||||||
|
|||||||
@@ -358,7 +358,6 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
|
|
||||||
private _state: GridTableState;
|
private _state: GridTableState;
|
||||||
|
|
||||||
private scrolled = false;
|
|
||||||
private visible = false;
|
private visible = false;
|
||||||
|
|
||||||
private rowHeight: number;
|
private rowHeight: number;
|
||||||
@@ -450,8 +449,6 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
);
|
);
|
||||||
this.dataProvider.dataRows = collection;
|
this.dataProvider.dataRows = collection;
|
||||||
this.table.updateRowCount();
|
this.table.updateRowCount();
|
||||||
// when we are removed slickgrid acts badly so we need to account for that
|
|
||||||
this.scrolled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// actionsOrientation controls the orientation (horizontal or vertical) of the actionBar
|
// actionsOrientation controls the orientation (horizontal or vertical) of the actionBar
|
||||||
@@ -520,8 +517,6 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
this._register(this.dataProvider.onFilterStateChange(() => { this.layout(); }));
|
this._register(this.dataProvider.onFilterStateChange(() => { this.layout(); }));
|
||||||
this._register(this.table.onContextMenu(this.contextMenu, this));
|
this._register(this.table.onContextMenu(this.contextMenu, this));
|
||||||
this._register(this.table.onClick(this.onTableClick, this));
|
this._register(this.table.onClick(this.onTableClick, this));
|
||||||
//This listener is used for correcting auto-scroling when clicking on the header for reszing.
|
|
||||||
this._register(this.table.onHeaderClick(this.onHeaderClick, this));
|
|
||||||
this._register(this.dataProvider.onFilterStateChange(() => {
|
this._register(this.dataProvider.onFilterStateChange(() => {
|
||||||
const columns = this.table.columns as FilterableColumn<T>[];
|
const columns = this.table.columns as FilterableColumn<T>[];
|
||||||
this.state.columnFilters = columns.filter((column) => column.filterValues?.length > 0).map(column => {
|
this.state.columnFilters = columns.filter((column) => column.filterValues?.length > 0).map(column => {
|
||||||
@@ -582,10 +577,6 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
// so ignore those events
|
// so ignore those events
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.scrolled && (this.state.scrollPositionY || this.state.scrollPositionX) && isInDOM(this.container)) {
|
|
||||||
this.scrolled = true;
|
|
||||||
this.restoreScrollState();
|
|
||||||
}
|
|
||||||
if (this.state && isInDOM(this.container)) {
|
if (this.state && isInDOM(this.container)) {
|
||||||
this.state.scrollPositionY = data.scrollTop;
|
this.state.scrollPositionY = data.scrollTop;
|
||||||
this.state.scrollPositionX = data.scrollLeft;
|
this.state.scrollPositionX = data.scrollLeft;
|
||||||
@@ -664,11 +655,6 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
this._state = val;
|
this._state = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
private onHeaderClick(event: ITableMouseEvent) {
|
|
||||||
//header clicks must be accounted for as they force the table to scroll to the top;
|
|
||||||
this.scrolled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getRowData(start: number, length: number): Promise<ICellValue[][]> {
|
private async getRowData(start: number, length: number): Promise<ICellValue[][]> {
|
||||||
let subset;
|
let subset;
|
||||||
if (this.dataProvider.isDataInMemory) {
|
if (this.dataProvider.isDataInMemory) {
|
||||||
|
|||||||
Reference in New Issue
Block a user