Skip to content

Commit 8ee7a49

Browse files
wdevfxAlyar666
andauthored
DataGrid: Fix incorrect display of headers and filter row when there are fixed, banded, and grouped columns (T1279722) (DevExpress#30778) (DevExpress#30837)
Co-authored-by: Alyar <[email protected]>
1 parent 10ce2b0 commit 8ee7a49

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
@@ -610,17 +610,26 @@ export class ColumnsController extends modules.Controller {
610610
expandColumn = this.columnOption('command:expand');
611611
}
612612

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

625634
return expandColumns;
626635
}

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)