Skip to content

Commit

Permalink
Update data viewer column resizing (#1121)
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken authored Jun 5, 2022
1 parent 7fd2762 commit 8f5f781
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,10 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
sortable: true,
resizable: true,
filter: true,
width: 100,
minWidth: 50,
filterParams: {
buttons: ['reset', 'apply']
buttons: ['reset', 'apply']
}
},
columnDefs: data.columns,
Expand All @@ -519,11 +521,11 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
enableCellTextSelection: true,
ensureDomOrder: true,
tooltipShowDelay: 100,
onGridReady: function (params) {
gridOptions.api.sizeColumnsToFit();
autoSizeAll(false);
}
onFirstDataRendered: onFirstDataRendered
};
function onFirstDataRendered(params) {
gridOptions.columnApi.autoSizeAllColumns(false);
}
function updateTheme() {
const gridDiv = document.querySelector('#myGrid');
if (document.body.classList.contains('vscode-light')) {
Expand All @@ -532,13 +534,6 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
gridDiv.className = 'ag-theme-balham-dark';
}
}
function autoSizeAll(skipHeader) {
var allColumnIds = [];
gridOptions.columnApi.getAllColumns().forEach(function (column) {
allColumnIds.push(column.colId);
});
gridOptions.columnApi.autoSizeColumns(allColumnIds, skipHeader);
}
document.addEventListener('DOMContentLoaded', () => {
gridOptions.columnDefs.forEach(function(column) {
if (column.type === 'dateColumn') {
Expand Down

0 comments on commit 8f5f781

Please sign in to comment.