Skip to content

Commit be6ba51

Browse files
authored
DataGrid: Implementing reordering of grouped columns using keyboard navigation (DevExpress#29628)
Co-authored-by: Alyar <>
1 parent b34003e commit be6ba51

File tree

34 files changed

+841
-247
lines changed

34 files changed

+841
-247
lines changed

apps/react-storybook/stories/examples/datagrid/DataGrid.stories.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const columnOptions = {
5353
dataField: 'Country',
5454
fixed: true,
5555
},
56-
'Country',
5756
'Area',
5857
'Population_Urban',
5958
'Population_Rural',
@@ -118,6 +117,24 @@ const columnOptions = {
118117
}],
119118
}],
120119
}],
120+
groupColumns: [
121+
'ID',
122+
{
123+
dataField: 'Country',
124+
groupIndex: 0,
125+
},
126+
{
127+
dataField: 'Area',
128+
groupIndex: 1,
129+
},
130+
'Population_Urban',
131+
'Population_Rural',
132+
'Population_Total',
133+
'GDP_Agriculture',
134+
'GDP_Industry',
135+
'GDP_Services',
136+
'GDP_Total',
137+
],
121138
};
122139

123140
const meta: Meta<typeof DataGrid> = {
@@ -227,5 +244,8 @@ export const ColumnReordering: Story = {
227244
columnFixing: {
228245
enabled: false
229246
},
247+
groupPanel: {
248+
visible: true,
249+
},
230250
}
231251
}

e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/columnReordering.visual.ts

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,38 @@ test('The column should not be reordered when it has allowReordering set to fals
139139
});
140140
});
141141

142+
test('The column should not be reordered when allowColumnReordering is false and group panel is visible', async (t) => {
143+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
144+
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
145+
const firstHeaderCell = dataGrid.getHeaders().getHeaderRow(0).getHeaderCell(0);
146+
147+
await t
148+
.click(firstHeaderCell.element)
149+
.pressKey('ctrl+right');
150+
151+
await takeScreenshot(
152+
'reorder_column_when_allowColumnReordering_is_false_and_group_panel_is_visible',
153+
dataGrid.element,
154+
);
155+
156+
await t.expect(compareResults.isValid())
157+
.ok(compareResults.errorMessages());
158+
}).before(async () => {
159+
await createWidget('dxDataGrid', {
160+
allowColumnReordering: false,
161+
groupPanel: {
162+
visible: true,
163+
allowColumnDragging: true,
164+
},
165+
dataSource: [{
166+
field1: 'test1',
167+
field2: 'test2',
168+
field3: 'test3',
169+
field4: 'test4',
170+
}],
171+
});
172+
});
173+
142174
// Fixed columns
143175
test('reorder fixed left column to right', async (t) => {
144176
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
@@ -386,6 +418,118 @@ test('reorder sticky column to right when there are fixed columns', async (t) =>
386418
});
387419
});
388420

421+
test('reorder fixed right column to right when there is a command column on the right', async (t) => {
422+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
423+
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
424+
const firstFixedRightHeader = dataGrid.getHeaders().getHeaderRow(0).getHeaderCell(6);
425+
426+
await t
427+
.click(firstFixedRightHeader.element)
428+
.pressKey('ctrl+right')
429+
.pressKey('ctrl+right');
430+
431+
await takeScreenshot(
432+
'reorder_fixed_right_column_to_right_when_there_is_command_column_on_right',
433+
dataGrid.element,
434+
);
435+
436+
await t.expect(compareResults.isValid())
437+
.ok(compareResults.errorMessages());
438+
}).before(async () => {
439+
await createWidget('dxDataGrid', {
440+
columnWidth: 100,
441+
allowColumnReordering: true,
442+
editing: {
443+
mode: 'row',
444+
allowUpdating: true,
445+
},
446+
dataSource: [{
447+
field1: 'test1',
448+
field2: 'test2',
449+
field3: 'test3',
450+
field4: 'test4',
451+
field5: 'test5',
452+
field6: 'test6',
453+
field7: 'test7',
454+
field8: 'test8',
455+
}],
456+
customizeColumns: (columns) => {
457+
columns[0].fixed = true;
458+
columns[0].fixedPosition = 'right';
459+
columns[7].fixed = true;
460+
columns[7].fixedPosition = 'right';
461+
},
462+
});
463+
});
464+
465+
test('reorder fixed right column to right when there is a custom command column on the right', async (t) => {
466+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
467+
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
468+
const firstFixedRightHeader = dataGrid.getHeaders().getHeaderRow(0).getHeaderCell(6);
469+
470+
await t
471+
.click(firstFixedRightHeader.element)
472+
.pressKey('ctrl+right')
473+
.pressKey('ctrl+right')
474+
.pressKey('ctrl+right');
475+
476+
await takeScreenshot(
477+
'reorder_fixed_right_column_to_right_when_there_is_custom_command_column_on_right',
478+
dataGrid.element,
479+
);
480+
481+
await t.expect(compareResults.isValid())
482+
.ok(compareResults.errorMessages());
483+
}).before(async () => {
484+
await createWidget('dxDataGrid', {
485+
columnWidth: 100,
486+
allowColumnReordering: true,
487+
editing: {
488+
mode: 'row',
489+
allowUpdating: true,
490+
},
491+
dataSource: [{
492+
field1: 'test1',
493+
field2: 'test2',
494+
field3: 'test3',
495+
field4: 'test4',
496+
field5: 'test5',
497+
field6: 'test6',
498+
field7: 'test7',
499+
field8: 'test8',
500+
}],
501+
columns: [
502+
{
503+
dataField: 'field1',
504+
fixed: true,
505+
fixedPosition: 'right',
506+
},
507+
'field2',
508+
'field3',
509+
'field4',
510+
'field5',
511+
'field6',
512+
'field7',
513+
{
514+
dataField: 'field8',
515+
fixed: true,
516+
fixedPosition: 'right',
517+
},
518+
{
519+
type: 'buttons',
520+
fixed: true,
521+
fixedPosition: 'right',
522+
},
523+
],
524+
customizeColumns: (columns) => {
525+
columns[0].fixed = true;
526+
columns[0].fixedPosition = 'right';
527+
columns[7].fixed = true;
528+
columns[7].fixedPosition = 'right';
529+
},
530+
});
531+
});
532+
389533
// Band columns
390534
test('reorder band column to right', async (t) => {
391535
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
-2 Bytes
Loading
Loading
Loading
Loading
9.32 KB
Loading
9.27 KB
Loading
9.33 KB
Loading
9.27 KB
Loading

0 commit comments

Comments
 (0)