mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
@@ -37,7 +37,7 @@ export class HeaderFilter<T extends Slick.SlickData> {
|
|||||||
private columnDef!: FilterableColumn<T>;
|
private columnDef!: FilterableColumn<T>;
|
||||||
private buttonStyles?: IButtonStyles;
|
private buttonStyles?: IButtonStyles;
|
||||||
private disposableStore = new DisposableStore();
|
private disposableStore = new DisposableStore();
|
||||||
public enabled: boolean = true;
|
private _enabled: boolean = true;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
@@ -435,4 +435,18 @@ export class HeaderFilter<T extends Slick.SlickData> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get enabled(): boolean {
|
||||||
|
return this._enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set enabled(value: boolean) {
|
||||||
|
if (this._enabled !== value) {
|
||||||
|
this._enabled = value;
|
||||||
|
// force the table header to redraw.
|
||||||
|
this.grid.getColumns().forEach((column) => {
|
||||||
|
this.grid.updateColumnHeader(column.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,6 +430,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
this.renderGridDataRowsRange(startIndex, count);
|
this.renderGridDataRowsRange(startIndex, count);
|
||||||
});
|
});
|
||||||
this.dataProvider.dataRows = collection;
|
this.dataProvider.dataRows = collection;
|
||||||
|
this.setFilterState();
|
||||||
this.table.updateRowCount();
|
this.table.updateRowCount();
|
||||||
await this.setupState();
|
await this.setupState();
|
||||||
}
|
}
|
||||||
@@ -525,7 +526,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
};
|
};
|
||||||
this.table.rerenderGrid();
|
this.table.rerenderGrid();
|
||||||
}));
|
}));
|
||||||
if (this.configurationService.getValue<boolean>('workbench')['enablePreviewFeatures']) {
|
if (this.enableFilteringFeature) {
|
||||||
this.filterPlugin = new HeaderFilter();
|
this.filterPlugin = new HeaderFilter();
|
||||||
attachButtonStyler(this.filterPlugin, this.themeService);
|
attachButtonStyler(this.filterPlugin, this.themeService);
|
||||||
this.table.registerPlugin(this.filterPlugin);
|
this.table.registerPlugin(this.filterPlugin);
|
||||||
@@ -686,15 +687,25 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
public updateResult(resultSet: ResultSetSummary) {
|
public updateResult(resultSet: ResultSetSummary) {
|
||||||
this._resultSet = resultSet;
|
this._resultSet = resultSet;
|
||||||
if (this.table && this.visible) {
|
if (this.table && this.visible) {
|
||||||
if (this.configurationService.getValue<boolean>('workbench')['enablePreviewFeatures'] && this.options.inMemoryDataProcessing && this.options.inMemoryDataCountThreshold < resultSet.rowCount) {
|
|
||||||
this.filterPlugin.enabled = false;
|
|
||||||
}
|
|
||||||
this.dataProvider.length = resultSet.rowCount;
|
this.dataProvider.length = resultSet.rowCount;
|
||||||
|
this.setFilterState();
|
||||||
this.table.updateRowCount();
|
this.table.updateRowCount();
|
||||||
}
|
}
|
||||||
this._onDidChange.fire(undefined);
|
this._onDidChange.fire(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get enableFilteringFeature(): boolean {
|
||||||
|
return this.configurationService.getValue<boolean>('workbench')['enablePreviewFeatures'];
|
||||||
|
}
|
||||||
|
|
||||||
|
private setFilterState(): void {
|
||||||
|
if (this.enableFilteringFeature) {
|
||||||
|
const rowCount = this.table.getData().getLength();
|
||||||
|
this.filterPlugin.enabled = this.options.inMemoryDataProcessing
|
||||||
|
&& (this.options.inMemoryDataCountThreshold === undefined || this.options.inMemoryDataCountThreshold >= rowCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private generateContext(cell?: Slick.Cell): IGridActionContext {
|
private generateContext(cell?: Slick.Cell): IGridActionContext {
|
||||||
const selection = this.selectionModel.getSelectedRanges();
|
const selection = this.selectionModel.getSelectedRanges();
|
||||||
return <IGridActionContext>{
|
return <IGridActionContext>{
|
||||||
|
|||||||
Reference in New Issue
Block a user