Skip to content

Commit 9de8d34

Browse files
sstoyanovIGbkulov
authored andcommitted
fix(igx-grid): Change checks for moving left/right, #4412 (#4417)
1 parent ef844c3 commit 9de8d34

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ export class IgxExcelStyleColumnMovingComponent {
2626
}
2727

2828
get canNotMoveLeft() {
29-
const prevIndex = this.grid.columns.indexOf(this.column) - 1;
3029
return this.column.visibleIndex === 0 ||
3130
(this.grid.unpinnedColumns.indexOf(this.column) === 0 && this.column.disablePinning) ||
32-
(this.column.level !== 0 && this.grid.columns[prevIndex] && this.grid.columns[prevIndex].level !== this.column.level);
31+
(this.column.level !== 0 && !this.findColumn(0, this.visibleColumns));
3332
}
3433

3534
get canNotMoveRight() {
36-
const nextIndex = this.grid.columns.indexOf(this.column) + 1;
3735
return this.column.visibleIndex === this.visibleColumns.length - 1 ||
38-
(this.column.level !== 0 && this.grid.columns[nextIndex] && this.grid.columns[nextIndex].level !== this.column.level);
36+
(this.column.level !== 0 && !this.findColumn(1, this.visibleColumns));
3937
}
4038

4139
public onMoveButtonClicked(moveDirection) {
@@ -66,7 +64,12 @@ export class IgxExcelStyleColumnMovingComponent {
6664
}
6765
}
6866
} else {
69-
return columns[index + 1];
67+
while (index < columns.length - 1) {
68+
index++;
69+
if (columns[index].level === this.column.level && columns[index].parent === this.column.parent) {
70+
return columns[index];
71+
}
72+
}
7073
}
7174
}
7275
}

0 commit comments

Comments
 (0)