From 6732cf68438436940098954e93bb54739ebc4180 Mon Sep 17 00:00:00 2001 From: Alyar <> Date: Tue, 8 Oct 2024 17:52:51 +0400 Subject: [PATCH] Fix case when columnHidingEnabled = false and columns have hidingPriority --- .../stickyColumns/withAdaptability.ts | 34 +++++++++++++++++-- .../sticky_columns/m_sticky_columns.ts | 5 +-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/e2e/testcafe-devextreme/tests/dataGrid/stickyColumns/withAdaptability.ts b/e2e/testcafe-devextreme/tests/dataGrid/stickyColumns/withAdaptability.ts index e008a1f124e7..04600df0916c 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/stickyColumns/withAdaptability.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/stickyColumns/withAdaptability.ts @@ -71,10 +71,40 @@ fixture.disablePageReloads`Sticky columns - Adaptability` column.hidingPriority = index; column.width = 200; - - return column; }); }, columnHidingEnabled: true, })); }); + +safeSizeTest('Sticky columns with sticky positions when columnHidingEnabled = false and columns have hidingPriority', async (t) => { + const { takeScreenshot, compareResults } = createScreenshotsComparer(t); + const dataGrid = new DataGrid(DATA_GRID_SELECTOR); + + await takeScreenshot('adaptability_sticky_columns_with_sticky_positions_and_hiding_priority_1.png', dataGrid.element); + + await dataGrid.scrollTo(t, { x: 10000 }); + + await takeScreenshot('adaptability_sticky_columns_with_sticky_positions_and_hiding_priority_2.png', dataGrid.element); + + await t + .expect(compareResults.isValid()) + .ok(compareResults.errorMessages()); +}, [900, 800]).before(async () => createWidget('dxDataGrid', { + ...defaultConfig, + width: 800, + customizeColumns(columns) { + columns.forEach((column, index) => { + if (index === 1 || index === 4) { + column.fixed = true; + column.fixedPosition = 'sticky'; + } else { + column.fixed = false; + } + + column.hidingPriority = index; + column.width = 200; + }); + }, + columnHidingEnabled: false, +})); diff --git a/packages/devextreme/js/__internal/grids/grid_core/sticky_columns/m_sticky_columns.ts b/packages/devextreme/js/__internal/grids/grid_core/sticky_columns/m_sticky_columns.ts index 7ae441804f34..ba0d80c361c3 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/sticky_columns/m_sticky_columns.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/sticky_columns/m_sticky_columns.ts @@ -217,14 +217,15 @@ const baseStickyColumns = >(Base: T) => class protected _resizeCore() { const isStickyColumns = this._isStickyColumns(); - const columnHidingEnabled = this.option('columnHidingEnabled'); + const adaptiveColumns = this.getController('adaptiveColumns'); + const hidingColumnsQueue = adaptiveColumns?.getHidingColumnsQueue(); super._resizeCore.apply(this, arguments as any); if (isStickyColumns) { this.setStickyOffsets(); - if (columnHidingEnabled) { + if (hidingColumnsQueue?.length) { this._updateBorderClasses(); } }