Skip to content

Commit eb91703

Browse files
Merge pull request #5624 from IgniteUI/tzhelev/fix-5604-8.2.x
Move column's parent instead of column itself in ESF - 8.2.x
2 parents 133eb69 + 8b5b15b commit eb91703

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-column-moving.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export class IgxExcelStyleColumnMovingComponent {
5555
}
5656
} else if (this.grid.unpinnedColumns.indexOf(this.column) === 0 && moveDirection === 0) {
5757
targetColumn = this.grid.pinnedColumns[this.grid.pinnedColumns.length - 1];
58+
if (targetColumn.parent) {
59+
targetColumn = targetColumn.topLevelParent;
60+
}
5861
moveDirection = 1;
5962
} else {
6063
targetColumn = this.findColumn(moveDirection, this.grid.unpinnedColumns);

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5645,6 +5645,44 @@ describe('IgxGrid - Filtering actions - Excel style filtering', () => {
56455645
expect(pinButton.classList.contains('igx-excel-filter__actions-pin--disabled')).toBe(true,
56465646
'pinButton should be disabled');
56475647
}));
5648+
5649+
it('Should pin column next to already pinned group by moving it to the left.', fakeAsync(() => {
5650+
// Test prerequisites
5651+
grid.width = '1000px';
5652+
fix.detectChanges();
5653+
tick(100);
5654+
// Adjust column widths, so their group can be pinned.
5655+
const columnFields = ['ID', 'ProductName', 'Downloads', 'Released', 'ReleaseDate', 'AnotherField'];
5656+
columnFields.forEach((columnField) => {
5657+
const col = grid.columns.find((c) => c.field === columnField);
5658+
col.width = '100px';
5659+
});
5660+
fix.detectChanges();
5661+
// Make 'AnotherField' column movable.
5662+
const column = grid.columns.find((c) => c.field === 'AnotherField');
5663+
column.movable = true;
5664+
fix.detectChanges();
5665+
5666+
// Pin the 'General Information' group by pinning its child 'ProductName' column.
5667+
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
5668+
fix.detectChanges();
5669+
GridFunctions.clickPinIconInExcelStyleFiltering(fix, false);
5670+
tick(200);
5671+
fix.detectChanges();
5672+
5673+
// Verify 'AnotherField' column is not pinned.
5674+
GridFunctions.verifyColumnIsPinned(column, false, 7);
5675+
5676+
// Try to pin the 'AnotherField' column by moving it to the left.
5677+
GridFunctions.clickExcelFilterIcon(fix, 'AnotherField');
5678+
fix.detectChanges();
5679+
GridFunctions.clickMoveLeftInExcelStyleFiltering(fix);
5680+
tick(200);
5681+
fix.detectChanges();
5682+
5683+
// Verify 'AnotherField' column is successfully pinned next to the column group.
5684+
GridFunctions.verifyColumnIsPinned(column, true, 8);
5685+
}));
56485686
});
56495687
});
56505688

0 commit comments

Comments
 (0)