From c099e0da617e07bb56606eae43108c3854a74351 Mon Sep 17 00:00:00 2001 From: Yordan Stoyanov Date: Tue, 24 Feb 2026 14:14:51 +0100 Subject: [PATCH 1/2] fix: keep custom content column headers visible when grid becomes empty --- .../datagrid-web/src/helpers/state/column/ColumnStore.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx b/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx index f2136d3e8e..e58b12d353 100644 --- a/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx +++ b/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx @@ -161,7 +161,7 @@ export class ColumnStore implements GridColumn { // there is no expression at all, treating as loaded and available return true; } - return this._visible.value ?? false; + return this._visible.value ?? true; } get loaded(): boolean { From 431abdbaae79282850a1f3a79e6e3f337ee83223 Mon Sep 17 00:00:00 2001 From: Yordan Stoyanov Date: Wed, 25 Feb 2026 16:18:00 +0100 Subject: [PATCH 2/2] fix: revert old fix and implement new - ensure column sizes are cleared for empty grids --- packages/pluggableWidgets/datagrid-web/CHANGELOG.md | 4 ++++ .../src/helpers/state/column/ColumnStore.tsx | 2 +- .../src/model/containers/Datagrid.container.ts | 2 +- .../datagrid-web/src/model/stores/GridSize.store.ts | 10 ++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/pluggableWidgets/datagrid-web/CHANGELOG.md b/packages/pluggableWidgets/datagrid-web/CHANGELOG.md index 7144838bb3..aaa0fcd919 100644 --- a/packages/pluggableWidgets/datagrid-web/CHANGELOG.md +++ b/packages/pluggableWidgets/datagrid-web/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- We fixed an issue where clearing a grid would cause wrong column grid calculation, causing unwanted scroll bars. + ## [3.8.1] - 2026-02-19 ### Fixed diff --git a/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx b/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx index e58b12d353..f2136d3e8e 100644 --- a/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx +++ b/packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnStore.tsx @@ -161,7 +161,7 @@ export class ColumnStore implements GridColumn { // there is no expression at all, treating as loaded and available return true; } - return this._visible.value ?? true; + return this._visible.value ?? false; } get loaded(): boolean { diff --git a/packages/pluggableWidgets/datagrid-web/src/model/containers/Datagrid.container.ts b/packages/pluggableWidgets/datagrid-web/src/model/containers/Datagrid.container.ts index 2493dfe82c..57ccffacb1 100644 --- a/packages/pluggableWidgets/datagrid-web/src/model/containers/Datagrid.container.ts +++ b/packages/pluggableWidgets/datagrid-web/src/model/containers/Datagrid.container.ts @@ -48,7 +48,7 @@ injected(DatasourceParamsController, CORE.setupService, DG.query, DG.combinedFil injected(DatasourceService, CORE.setupService, DG.queryGate, DG.refreshInterval.optional); injected(GridBasicData, CORE.mainGate); injected(WidgetRootViewModel, CORE.mainGate, CORE.config, DG.exportProgressService, SA_TOKENS.selectionDialogVM); -injected(GridSizeStore, CORE.atoms.hasMoreItems, DG.paginationConfig, DG.setPageAction); +injected(GridSizeStore, CORE.atoms.hasMoreItems, CORE.atoms.itemCount, DG.paginationConfig, DG.setPageAction); /** Pagination **/ injected(createSetPageAction, DG.query, DG.paginationConfig, DG.currentPage, DG.pageSize); diff --git a/packages/pluggableWidgets/datagrid-web/src/model/stores/GridSize.store.ts b/packages/pluggableWidgets/datagrid-web/src/model/stores/GridSize.store.ts index f894cc2bbf..8bb1f7730b 100644 --- a/packages/pluggableWidgets/datagrid-web/src/model/stores/GridSize.store.ts +++ b/packages/pluggableWidgets/datagrid-web/src/model/stores/GridSize.store.ts @@ -18,6 +18,7 @@ export class GridSizeStore { constructor( private readonly hasMoreItemsAtom: ComputedAtom, + private readonly itemCountAtom: ComputedAtom, private readonly paginationConfig: PaginationConfig, private readonly setPageAction: SetPageAction ) { @@ -75,6 +76,15 @@ export class GridSizeStore { } updateColumnSizes(sizes: number[]): void { + const itemCount = this.itemCountAtom.get(); + + // If grid is empty, always clear columnSizes to use natural CSS grid layout + // This ensures empty grids behave consistently whether freshly rendered or emptied + if (itemCount === 0) { + this.columnSizes = undefined; + return; + } + this.columnSizes = sizes; }