Fix resource viewer grid resizing (#13197)

* Fix resource viewer grid resizing

* keep height
This commit is contained in:
Charles Gagnon
2020-11-04 08:34:30 -08:00
committed by GitHub
parent b68d504f68
commit eeb7da4ace
3 changed files with 11 additions and 4 deletions

View File

@@ -115,6 +115,7 @@ export class ResourceViewerInput extends EditorInput {
resizable: col.resizable ?? true,
tooltip: col.tooltip,
width: col.width,
minWidth: col.width,
type: col.type
};
});

View File

@@ -79,7 +79,6 @@ export class ResourceViewerEditor extends EditorPane {
resourceViewerTableContainer.className = 'resource-viewer-table monaco-editor';
resourceViewerTableContainer.style.width = '100%';
resourceViewerTableContainer.style.height = '100%';
resourceViewerTableContainer.style.overflow = 'hidden';
resourceViewerTableContainer.style.position = 'relative';
this._resourceViewerTable = this._register(this._instantiationService.createInstance(ResourceViewerTable, resourceViewerTableContainer));
return resourceViewerTableContainer;
@@ -130,8 +129,10 @@ export class ResourceViewerEditor extends EditorPane {
}
public layout(dimension: DOM.Dimension): void {
this._resourceViewerTable.layout();
this._container.style.width = dimension.width + 'px';
this._container.style.height = dimension.height + 'px';
const actionbarHeight = DOM.getTotalHeight(this._actionBar.getContainer());
this._container.style.height = (dimension.height - actionbarHeight) + 'px';
}
private showContextMenu(anchor: ContextMenuAnchor, context: azdata.DataGridItem): void {

View File

@@ -49,8 +49,7 @@ export class ResourceViewerTable extends Disposable {
this._dataView.sort(args);
}
}, {
dataItemColumnValueExtractor: dataGridColumnValueExtractor,
forceFitColumns: true
dataItemColumnValueExtractor: dataGridColumnValueExtractor
}));
this._resourceViewerTable.setSelectionModel(new RowSelectionModel());
@@ -95,6 +94,7 @@ export class ResourceViewerTable extends Disposable {
public set columns(columns: Slick.Column<Slick.SlickData>[]) {
this._resourceViewerTable.columns = columns;
this._resourceViewerTable.autosizeColumns();
}
public set loading(isLoading: boolean) {
@@ -113,6 +113,11 @@ export class ResourceViewerTable extends Disposable {
this._resourceViewerTable.unregisterPlugin(plugin);
}
public layout(): void {
this._resourceViewerTable.resizeCanvas();
this._resourceViewerTable.autosizeColumns();
}
public focus(): void {
this._resourceViewerTable.focus();
}