redraw table header (#14963)

This commit is contained in:
Alan Ren
2021-04-05 10:11:53 -07:00
committed by GitHub
parent 6b855a9776
commit 1dad2f36e3
2 changed files with 30 additions and 5 deletions

View File

@@ -430,6 +430,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
this.renderGridDataRowsRange(startIndex, count);
});
this.dataProvider.dataRows = collection;
this.setFilterState();
this.table.updateRowCount();
await this.setupState();
}
@@ -525,7 +526,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
};
this.table.rerenderGrid();
}));
if (this.configurationService.getValue<boolean>('workbench')['enablePreviewFeatures']) {
if (this.enableFilteringFeature) {
this.filterPlugin = new HeaderFilter();
attachButtonStyler(this.filterPlugin, this.themeService);
this.table.registerPlugin(this.filterPlugin);
@@ -686,15 +687,25 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
public updateResult(resultSet: ResultSetSummary) {
this._resultSet = resultSet;
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.setFilterState();
this.table.updateRowCount();
}
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 {
const selection = this.selectionModel.getSelectedRanges();
return <IGridActionContext>{