mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fixed #3961 Removed hardcoded value in notebook and use QueryEditor Result RowHight to keep it consistent (#5208)
This commit is contained in:
@@ -14,6 +14,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
|||||||
import { MouseWheelSupport } from 'sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin';
|
import { MouseWheelSupport } from 'sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin';
|
||||||
import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin';
|
import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin';
|
||||||
import { AdditionalKeyBindings } from 'sql/base/browser/ui/table/plugins/additionalKeyBindings.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.
|
* Render DataResource as a grid into a host node.
|
||||||
@@ -39,7 +40,6 @@ export function renderDataResource(
|
|||||||
let tableContainer = document.createElement('div');
|
let tableContainer = document.createElement('div');
|
||||||
tableContainer.className = 'notebook-cellTable';
|
tableContainer.className = 'notebook-cellTable';
|
||||||
|
|
||||||
const ROW_HEIGHT = 29;
|
|
||||||
const BOTTOM_PADDING_AND_SCROLLBAR = 14;
|
const BOTTOM_PADDING_AND_SCROLLBAR = 14;
|
||||||
let tableResultsData = new TableDataView();
|
let tableResultsData = new TableDataView();
|
||||||
let columns: string[] = sourceObject.schema.fields.map(val => val.name);
|
let columns: string[] = sourceObject.schema.fields.map(val => val.name);
|
||||||
@@ -57,7 +57,7 @@ export function renderDataResource(
|
|||||||
let detailTable = new Table(tableContainer, {
|
let detailTable = new Table(tableContainer, {
|
||||||
dataProvider: tableResultsData, columns: columnsTransformed
|
dataProvider: tableResultsData, columns: columnsTransformed
|
||||||
}, {
|
}, {
|
||||||
rowHeight: ROW_HEIGHT,
|
rowHeight: RESULTS_GRID_DEFAULTS.rowHeight,
|
||||||
forceFitColumns: false,
|
forceFitColumns: false,
|
||||||
defaultColumnWidth: 120
|
defaultColumnWidth: 120
|
||||||
});
|
});
|
||||||
@@ -67,7 +67,7 @@ export function renderDataResource(
|
|||||||
detailTable.registerPlugin(new AdditionalKeyBindings());
|
detailTable.registerPlugin(new AdditionalKeyBindings());
|
||||||
let numRows = detailTable.grid.getDataLength();
|
let numRows = detailTable.grid.getDataLength();
|
||||||
// Need to include column headers and scrollbar, so that's why 1 needs to be added
|
// 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 no rows are in the grid, set height to 100% of the container's height
|
||||||
if (numRows === 0) {
|
if (numRows === 0) {
|
||||||
tableContainer.style.height = '100%';
|
tableContainer.style.height = '100%';
|
||||||
|
|||||||
Reference in New Issue
Block a user