Skip to content

T1329677 DataGrid - Column width changes are not applied immediately - #34818

Draft
nightskylark wants to merge 5 commits into
DevExpress:mainfrom
nightskylark:T1329677-fix
Draft

T1329677 DataGrid - Column width changes are not applied immediately#34818
nightskylark wants to merge 5 commits into
DevExpress:mainfrom
nightskylark:T1329677-fix

Conversation

@nightskylark

Copy link
Copy Markdown
Contributor

Fixes a DataGrid bug: when columnAutoWidth is enabled, changing a column's width via columnOption('field', 'width', N) at runtime is silently ignored — the column keeps its previously auto-fitted width until an explicit repaint()/reinit() is triggered.

Bug

  1. columnAutoWidth's best-fit measurement pass caches the measured width into the column's internal visibleWidth option (m_grid_view.ts _setVisibleWidths).
  2. Rendering resolves the effective width as column.visibleWidth || column.width (m_columns_view.ts _columnOptionChanged).
  3. A subsequent columnOption(field, 'width', N) call only updates width — the stale visibleWidth is never invalidated, so the new width has no visible effect until a full repaint recomputes column state from scratch.

Fix

packages/devextreme/js/__internal/grids/grid_core/columns_controller/m_columns_controller_utils.ts:

  • Added isVisibleWidthChangePendingForColumn and invalidateStaleVisibleWidth helpers.
  • columnOptionCore now clears a stale column.visibleWidth whenever width is set explicitly, unless a visibleWidth change for the same column is already pending in the current (not yet fired) _columnChanges batch.

The "pending batch" check preserves the drag-resize flow in m_columns_resizing_reordering.ts (setColumnWidth's ratio-adapt branch), which intentionally sets visibleWidth and width together in the same batch for instant visual feedback while dragging — that pairing must not be broken. External/API-driven calls (the reported bug, and the AI-assistant columnsResizeCommand) have no such pending pairing, so their stale visibleWidth is correctly cleared.

@nightskylark nightskylark self-assigned this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant