Skip to content

Commit 6ad4106

Browse files
authored
DataGrid: Fix incorrect display of headers and filter row when there are fixed, banded, and grouped columns (T1276277) (DevExpress#30778)
Co-authored-by: Alyar <>
1 parent eec8403 commit 6ad4106

File tree

5 files changed

+73
-12
lines changed

5 files changed

+73
-12
lines changed
Loading
Loading
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
2+
import DataGrid from 'devextreme-testcafe-models/dataGrid';
3+
import { safeSizeTest } from '../../../../helpers/safeSizeTest';
4+
import { createWidget } from '../../../../helpers/createWidget';
5+
import url from '../../../../helpers/getPageUrl';
6+
7+
const DATA_GRID_SELECTOR = '#container';
8+
9+
fixture.disablePageReloads`Band sticky columns`
10+
.page(url(__dirname, '../../../container.html'));
11+
12+
[false, true].forEach((rtlEnabled) => {
13+
// T1279722
14+
safeSizeTest(`Headers and filter row should display correctly after scrolling to the max right position when there is a grouped column (rtl=${rtlEnabled})`, async (t) => {
15+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
16+
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
17+
18+
await t.expect(dataGrid.isReady()).ok();
19+
20+
await dataGrid.scrollTo(t, { x: rtlEnabled ? 0 : 10000 });
21+
await takeScreenshot(`T1279722_band_sticky_columns-headers_with_filter_row_and_grouped_column_(rtl=${rtlEnabled}).png`, dataGrid.element);
22+
23+
await t
24+
.expect(compareResults.isValid())
25+
.ok(compareResults.errorMessages());
26+
}, [900, 800]).before(async () => createWidget('dxDataGrid', {
27+
dataSource: [
28+
{
29+
field0: 1, field1: 1, field2: 1, field3: 1, field4: 1, field5: 1, field6: 1, field7: 1,
30+
},
31+
],
32+
keyExpr: 'field0',
33+
width: 500,
34+
columnWidth: 100,
35+
columns: [{
36+
dataField: 'field0',
37+
fixed: true,
38+
fixedPosition: rtlEnabled ? 'right' : 'left',
39+
}, {
40+
caption: 'Band',
41+
fixed: true,
42+
fixedPosition: rtlEnabled ? 'right' : 'left',
43+
columns: [{
44+
dataField: 'field1',
45+
groupIndex: 0,
46+
}, 'field2'],
47+
}, 'field3', 'field4', 'field5', 'field6', 'field7'],
48+
showBorders: true,
49+
filterRow: { visible: true },
50+
rtlEnabled,
51+
}));
52+
});

packages/devextreme/js/__internal/grids/grid_core/columns_controller/m_columns_controller.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -613,17 +613,26 @@ export class ColumnsController extends modules.Controller {
613613
expandColumn = this.columnOption('command:expand');
614614
}
615615

616-
expandColumns = map(expandColumns, (column) => extend({}, column, {
617-
visibleWidth: null,
618-
minWidth: null,
619-
cellTemplate: !isDefined(column.groupIndex) ? column.cellTemplate : null,
620-
headerCellTemplate: null,
621-
fixed: !isDefined(column.groupIndex) || !isFixedFirstGroupColumn ? isColumnFixing : true,
622-
fixedPosition: rtlEnabled ? 'right' : 'left',
623-
}, expandColumn, {
624-
index: column.index,
625-
type: column.type || GROUP_COMMAND_COLUMN_NAME,
626-
}));
616+
expandColumns = map(expandColumns, (column) => extend(
617+
{},
618+
{
619+
...column,
620+
ownerBand: undefined,
621+
},
622+
{
623+
visibleWidth: null,
624+
minWidth: null,
625+
cellTemplate: !isDefined(column.groupIndex) ? column.cellTemplate : null,
626+
headerCellTemplate: null,
627+
fixed: !isDefined(column.groupIndex) || !isFixedFirstGroupColumn ? isColumnFixing : true,
628+
fixedPosition: rtlEnabled ? 'right' : 'left',
629+
},
630+
expandColumn,
631+
{
632+
index: column.index,
633+
type: column.type || GROUP_COMMAND_COLUMN_NAME,
634+
},
635+
));
627636

628637
return expandColumns;
629638
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ export const isFirstOrLastColumn = function (
991991
): boolean {
992992
const targetColumnIndex = targetColumn.index;
993993
const bandColumnsCache = that.getBandColumnsCache();
994-
const parentBandColumns = getParentBandColumns(targetColumnIndex, bandColumnsCache.columnParentByIndex);
994+
const parentBandColumns = !isDefined(targetColumn.type) && getParentBandColumns(targetColumnIndex, bandColumnsCache.columnParentByIndex);
995995

996996
if (parentBandColumns?.length) {
997997
return isFirstOrLastBandColumn(that, parentBandColumns.concat([targetColumn]), onlyWithinBandColumn, isLast, fixedPosition);

0 commit comments

Comments
 (0)