Auto Column Sizing (#2778)

* add auto column sizing

* add break for performance

* update with new library
This commit is contained in:
Anthony Dresser
2019-01-08 13:05:53 -08:00
committed by GitHub
parent e31747d087
commit 954d0d954f
3 changed files with 82 additions and 7 deletions

View File

@@ -420,12 +420,12 @@ class GridTable<T> extends Disposable implements IView {
@IContextMenuService private contextMenuService: IContextMenuService,
@IInstantiationService private instantiationService: IInstantiationService,
@IEditorService private editorService: IEditorService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IConfigurationService private configurationService: IConfigurationService
) {
super();
this.container.style.width = '100%';
this.container.style.height = '100%';
// this.container.style.marginBottom = BOTTOM_PADDING + 'px';
this.container.className = 'grid-panel';
this.columns = this.resultSet.columnInfo.map((c, i) => {
@@ -507,7 +507,7 @@ class GridTable<T> extends Disposable implements IView {
this.table = this._register(new Table(tableContainer, { dataProvider: this.dataProvider, columns: this.columns }, tableOptions));
this.table.setSelectionModel(this.selectionModel);
this.table.registerPlugin(new MouseWheelSupport());
this.table.registerPlugin(new AutoColumnSize());
this.table.registerPlugin(new AutoColumnSize({ autoSizeOnRender: this.configurationService.getValue('resultsGrid.autoSizeColumns') }));
this.table.registerPlugin(copyHandler);
this.table.registerPlugin(this.rowNumberColumn);
this.table.registerPlugin(new AdditionalKeyBindings());

View File

@@ -21,7 +21,6 @@ const resultsGridConfiguration: IConfigurationNode = {
type: 'object',
title: nls.localize('resultsGridConfigurationTitle', "Results Grid"),
overridable: true,
scope: ConfigurationScope.RESOURCE,
properties: {
'resultsGrid.fontFamily': {
type: 'string',
@@ -62,6 +61,11 @@ const resultsGridConfiguration: IConfigurationNode = {
],
default: RESULTS_GRID_DEFAULTS.cellPadding,
description: nls.localize('cellPadding', "Controls the cell padding in pixels")
},
'resultsGrid.autoSizeColumns': {
type: 'boolean',
default: false,
description: nls.localize('autoSizeColumns', "Auto size the columns width on inital results. Could have performance problems with large number of columns or large cells")
}
}
};