Skip to content

Commit b759d98

Browse files
authored
Merge pull request #6385 from IgniteUI/amarinov/HGrid82
RowDrag ghost is misplaced in HierarchicalGrid - 8.2.x
2 parents bdecbc0 + 726fb17 commit b759d98

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

projects/igniteui-angular/src/lib/grids/row-drag.directive.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IRowDragEndEventArgs, IRowDragStartEventArgs } from './grid-base.compon
44
import { KEYS } from '../core/utils';
55
import { fromEvent, Subscription } from 'rxjs';
66
import { IgxRowComponent, IgxGridBaseComponent, IGridDataBindable } from './grid';
7+
import { IgxHierarchicalRowComponent } from './hierarchical-grid/hierarchical-row.component';
78

89

910
const ghostBackgroundClass = 'igx-grid__tr--ghost';
@@ -106,6 +107,15 @@ export class IgxRowDragDirective extends IgxDragDirective implements OnDestroy {
106107
};
107108
super.createGhost(pageX, pageY, this.row.nativeElement);
108109

110+
// check if there is an expander icon and create the ghost at the corresponding position
111+
if (this.isHierarchicalGrid) {
112+
const row = this.row as IgxHierarchicalRowComponent;
113+
if (row.expander) {
114+
const expanderWidth = row.expander.nativeElement.getBoundingClientRect().width;
115+
this._ghostHostX += expanderWidth;
116+
}
117+
}
118+
109119
const ghost = this.ghostElement;
110120

111121
const gridRect = this.row.grid.nativeElement.getBoundingClientRect();
@@ -144,6 +154,10 @@ export class IgxRowDragDirective extends IgxDragDirective implements OnDestroy {
144154
}
145155
this.endDragging();
146156
}
157+
158+
private get isHierarchicalGrid() {
159+
return this.row.grid.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid';
160+
}
147161
}
148162

149163
/**

0 commit comments

Comments
 (0)