Skip to content

Commit

Permalink
fixed #7295 Turbo table column re-order: The drag and drop should not…
Browse files Browse the repository at this point in the history
… be possible on the same column
  • Loading branch information
yigitfindikli committed Feb 26, 2019
1 parent 646f9c6 commit 9ad270b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
let dropHeaderOffset = DomHandler.getOffset(dropHeader);

if (this.draggedColumn != dropHeader) {
let dragIndex = DomHandler.indexWithinGroup(this.draggedColumn, 'preorderablecolumn');
let dropIndex = DomHandler.indexWithinGroup(dropHeader, 'preorderablecolumn');
let targetLeft = dropHeaderOffset.left - containerOffset.left;
let targetTop = containerOffset.top - dropHeaderOffset.top;
let columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
Expand All @@ -1732,8 +1734,14 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
this.dropPosition = -1;
}

this.reorderIndicatorUpViewChild.nativeElement.style.display = 'block';
this.reorderIndicatorDownViewChild.nativeElement.style.display = 'block';
if((dropIndex - dragIndex === 1 && this.dropPosition === -1) || (dropIndex - dragIndex === -1 && this.dropPosition === 1)) {
this.reorderIndicatorUpViewChild.nativeElement.style.display = 'none';
this.reorderIndicatorDownViewChild.nativeElement.style.display = 'none';
}
else {
this.reorderIndicatorUpViewChild.nativeElement.style.display = 'block';
this.reorderIndicatorDownViewChild.nativeElement.style.display = 'block';
}
}
else {
event.dataTransfer.dropEffect = 'none';
Expand Down

0 comments on commit 9ad270b

Please sign in to comment.