Skip to content

Commit fe2f3b7

Browse files
committed
cover unbound column case
1 parent 0200e61 commit fe2f3b7

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

e2e/testcafe-devextreme/tests/dataGrid/common/grouping/grouping.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ test('DataGrid should not lose grouping after the expandAll method if a grouped
320320
'b', 'c'],
321321
}));
322322

323-
test('DataGrid should not change group column after the expandAll method if a grouped column has string calculateGroupValue (T1308536)', async (t) => {
323+
test('DataGrid should not change group column after the expandAll method, string calculateGroupValue corresponds another column (T1308536)', async (t) => {
324324
const dataGrid = new DataGrid('#container');
325325
const firstGroupCellText = await dataGrid.getGroupRow(0).getCell(1).element.textContent;
326326

@@ -345,6 +345,39 @@ test('DataGrid should not change group column after the expandAll method if a gr
345345
calculateGroupValue: 'aLabel',
346346
},
347347
{ dataField: 'aLabel', visible: false },
348+
349+
'b', 'c'],
350+
}));
351+
352+
test('DataGrid should not change group column after the expandAll method, string calculateGroupValue corresponds another unbound column (T1308536)', async (t) => {
353+
const dataGrid = new DataGrid('#container');
354+
const firstGroupCellText = await dataGrid.getGroupRow(0).getCell(1).element.textContent;
355+
356+
await dataGrid.apiExpandAll();
357+
358+
await t
359+
.expect(dataGrid.apiColumnOption('a', 'groupIndex'))
360+
.eql(0)
361+
.expect(dataGrid.apiColumnOption('aLabel', 'groupIndex'))
362+
.eql(undefined)
363+
.expect(dataGrid.getGroupRow(0).getCell(1).element.textContent)
364+
.eql(firstGroupCellText);
365+
}).before(async () => createWidget('dxDataGrid', {
366+
dataSource: [{
367+
id: 0, a: 0, aLabel: 'A_0', b: 'B_0', c: 'C_0',
368+
}],
369+
keyExpr: 'id',
370+
grouping: { autoExpandAll: false },
371+
columns: [{
372+
dataField: 'a',
373+
groupIndex: 0,
374+
calculateGroupValue: 'aLabel',
375+
},
376+
{
377+
name: 'aLabel',
378+
caption: 'aLabel',
379+
calculateCellValue(data) { return data.aLabel; },
380+
},
348381
'b', 'c'],
349382
}));
350383

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,9 @@ export class ColumnsController extends modules.Controller {
13411341

13421342
each(columns, (_: number, column) => {
13431343
const isReferencedAsGroupValue = indexParameterName === 'groupIndex'
1344-
&& referencedGroupValues.includes(column.dataField);
1344+
&& referencedGroupValues.some(
1345+
(groupValue) => column.dataField === groupValue || column.name === groupValue,
1346+
);
13451347

13461348
if (!isReferencedAsGroupValue) {
13471349
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete

0 commit comments

Comments
 (0)