@@ -20,7 +20,7 @@ export class GridPinningDragSampleComponent implements OnInit {
2020 public pinningConfig : IPinningConfig = { rows : RowPinningPosition . Top } ;
2121
2222 constructor ( ) {
23- this . data = DATA ;
23+ this . data = [ ... DATA ] ;
2424 }
2525
2626 public ngOnInit ( ) {
@@ -56,6 +56,7 @@ export class GridPinningDragSampleComponent implements OnInit {
5656 // remove the row that was dragged and place it onto its new location
5757 this . grid . deleteRow ( ( args . dragData as RowType ) . key ) ;
5858 this . data . splice ( currRowIndex , 0 , args . dragData . data ) ;
59+ this . data = [ ...this . data ] ;
5960 if ( currentRow . pinned && ! args . dragData . pinned ) {
6061 this . grid . pinRow ( args . dragData . key , currRowPinnedIndex ) ;
6162 } else if ( ! currentRow . pinned && args . dragData . pinned ) {
@@ -75,8 +76,8 @@ export class GridPinningDragSampleComponent implements OnInit {
7576 private getCurrentRowIndex ( rowList , cursorPosition ) {
7677 for ( const row of rowList ) {
7778 const rowRect = row . nativeElement . getBoundingClientRect ( ) ;
78- if ( cursorPosition . y > rowRect . top + window . scrollY && cursorPosition . y < rowRect . bottom + window . scrollY &&
79- cursorPosition . x > rowRect . left + window . scrollX && cursorPosition . x < rowRect . right + window . scrollX ) {
79+ if ( cursorPosition . y > rowRect . top && cursorPosition . y < rowRect . bottom &&
80+ cursorPosition . x > rowRect . left && cursorPosition . x < rowRect . right ) {
8081 // return the index of the targeted row
8182 return this . data . indexOf ( this . data . find ( ( r ) => r . ID === row . key ) ) ;
8283 }
@@ -88,8 +89,8 @@ export class GridPinningDragSampleComponent implements OnInit {
8889 private getCurrentRowID ( rowList : IgxRowDirective [ ] , cursorPosition ) {
8990 for ( const row of rowList ) {
9091 const rowRect = row . nativeElement . getBoundingClientRect ( ) ;
91- if ( cursorPosition . y > rowRect . top + window . scrollY && cursorPosition . y < rowRect . bottom + window . scrollY &&
92- cursorPosition . x > rowRect . left + window . scrollX && cursorPosition . x < rowRect . right + window . scrollX ) {
92+ if ( cursorPosition . y > rowRect . top && cursorPosition . y < rowRect . bottom &&
93+ cursorPosition . x > rowRect . left && cursorPosition . x < rowRect . right ) {
9394 // return the ID of the targeted row
9495 return row . key ;
9596 }
0 commit comments