Fixed #3961 Removed hardcoded value in notebook and use QueryEditor Result RowHight to keep it consistent (#5208)

This commit is contained in:
Yurong He
2019-04-25 12:59:13 -07:00
committed by GitHub
parent 34457880c7
commit 5d5f44ba11

View File

@@ -14,6 +14,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { MouseWheelSupport } from 'sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin';
import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin';
import { AdditionalKeyBindings } from 'sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin';
import { RESULTS_GRID_DEFAULTS } from 'sql/parts/query/editor/queryResultsEditor';
/**
* Render DataResource as a grid into a host node.
@@ -39,7 +40,6 @@ export function renderDataResource(
let tableContainer = document.createElement('div');
tableContainer.className = 'notebook-cellTable';
const ROW_HEIGHT = 29;
const BOTTOM_PADDING_AND_SCROLLBAR = 14;
let tableResultsData = new TableDataView();
let columns: string[] = sourceObject.schema.fields.map(val => val.name);
@@ -57,7 +57,7 @@ export function renderDataResource(
let detailTable = new Table(tableContainer, {
dataProvider: tableResultsData, columns: columnsTransformed
}, {
rowHeight: ROW_HEIGHT,
rowHeight: RESULTS_GRID_DEFAULTS.rowHeight,
forceFitColumns: false,
defaultColumnWidth: 120
});
@@ -67,7 +67,7 @@ export function renderDataResource(
detailTable.registerPlugin(new AdditionalKeyBindings());
let numRows = detailTable.grid.getDataLength();
// Need to include column headers and scrollbar, so that's why 1 needs to be added
let rowsHeight = (numRows + 1) * ROW_HEIGHT + BOTTOM_PADDING_AND_SCROLLBAR;
let rowsHeight = (numRows + 1) * RESULTS_GRID_DEFAULTS.rowHeight + BOTTOM_PADDING_AND_SCROLLBAR;
// if no rows are in the grid, set height to 100% of the container's height
if (numRows === 0) {
tableContainer.style.height = '100%';