Skip to content

Commit

Permalink
Fixed #12291 - Table | On col reorder the col destination position in…
Browse files Browse the repository at this point in the history
…dicators are not shown properly
  • Loading branch information
cetincakiroglu committed Nov 28, 2022
1 parent 223ab78 commit a2cde03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/app/components/table/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
.p-datatable-reorder-indicator-up,
.p-datatable-reorder-indicator-down {
position: absolute;
display: none;
}

.p-datatable-reorderablerow-handle {
Expand Down
16 changes: 4 additions & 12 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ export class TableService {
</div>
<div #resizeHelper class="p-column-resizer-helper" style="display:none" *ngIf="resizableColumns"></div>
<span #reorderIndicatorUp class="pi pi-arrow-down p-datatable-reorder-indicator-up" style="display:none" *ngIf="reorderableColumns"></span>
<span #reorderIndicatorDown class="pi pi-arrow-up p-datatable-reorder-indicator-down" style="display:none" *ngIf="reorderableColumns"></span>
<span #reorderIndicatorUp class="pi pi-arrow-down p-datatable-reorder-indicator-up" style="display: none;" *ngIf="reorderableColumns"></span>
<span #reorderIndicatorDown class="pi pi-arrow-up p-datatable-reorder-indicator-down" style="display: none;" *ngIf="reorderableColumns"></span>
</div>
`,
providers: [TableService],
Expand Down Expand Up @@ -2051,14 +2051,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
this.reorderIndicatorDownViewChild.nativeElement.style.left = targetLeft - Math.ceil(this.reorderIconWidth / 2) + 'px';
this.dropPosition = -1;
}

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';
}
this.reorderIndicatorUpViewChild.nativeElement.style.display = 'block';
this.reorderIndicatorDownViewChild.nativeElement.style.display = 'block';
} else {
event.dataTransfer.dropEffect = 'none';
}
Expand All @@ -2068,8 +2062,6 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
onColumnDragLeave(event) {
if (this.reorderableColumns && this.draggedColumn) {
event.preventDefault();
this.reorderIndicatorUpViewChild.nativeElement.style.display = 'none';
this.reorderIndicatorDownViewChild.nativeElement.style.display = 'none';
}
}

Expand Down

0 comments on commit a2cde03

Please sign in to comment.