Skip to content

Commit f4a45e4

Browse files
MKirovaMayaKirova
authored andcommitted
feat(igxGrid): Add a dragRowID property to the grid which holds the id of the row that is dragged. Use that property instead of the row instance as the row instance data changes on scroll (due to virtualization). Can also be used in existing samples with row reorder + virtualization.
1 parent 96f1d39 commit f4a45e4

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
584584
*/
585585
public rowDragging = false;
586586

587+
/**
588+
* Gets the row ID that is being dragged.
589+
* @remarks
590+
* The row ID is either the primaryKey value or the data record instance.
591+
*/
592+
public dragRowID = null;
593+
587594

588595
/**
589596
* Gets/Sets whether the rows are editable.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class IgxRowDragDirective extends IgxDragDirective implements OnDestroy {
6060
this._clicked = false;
6161
return;
6262
}
63-
this.row.dragging = true;
63+
this.row.grid.dragRowID = this.row.rowID;
6464
this.row.grid.rowDragging = true;
6565
this.row.grid.markForCheck();
6666

@@ -143,7 +143,7 @@ export class IgxRowDragDirective extends IgxDragDirective implements OnDestroy {
143143

144144
private endDragging() {
145145
this.onTransitionEnd(null);
146-
this.row.dragging = false;
146+
this.row.grid.dragRowID = null;
147147
this.row.grid.rowDragging = false;
148148
this.row.grid.markForCheck();
149149
this._unsubscribe();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
248248
/**
249249
* @hidden
250250
*/
251-
public dragging = false;
251+
protected get dragging() {
252+
return this.grid.dragRowID === this.rowID;
253+
}
252254

253255
// TODO: Refactor
254256
public get inEditMode(): boolean {

0 commit comments

Comments
 (0)