Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nclemeur-daesim committed Mar 1, 2022
1 parent f639b8f commit b910dc5
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1252,21 +1252,16 @@ export default {
if (this.draggedColumn) {
let dragIndex = DomHandler.index(this.draggedColumn);
let dropIndex = DomHandler.index(this.findParentHeader(event.target));
let allowDrop = (dragIndex !== dropIndex);
if (allowDrop && ((dropIndex - dragIndex === 1 && this.dropPosition === -1) || (dragIndex - dropIndex === 1 && this.dropPosition === 1))) {
allowDrop = false;
}
let allowDrop = dragIndex !== dropIndex;
if (allowDrop) {
ObjectUtils.reorderArray(this.columns, dragIndex, dropIndex);
this.updateReorderableColumns();
this.$emit('column-reorder', {
originalEvent: event,
dragIndex: dragIndex,
dropIndex: dropIndex
});
if (this.dropPosition === 1 && dragIndex > dropIndex) {
dropIndex++;
} else if (this.dropPosition === -1 && dragIndex < dropIndex) {
dropIndex--;
}
}
allowDrop = dragIndex !== dropIndex;
this.$refs.reorderIndicatorUp.style.display = 'none';
this.$refs.reorderIndicatorDown.style.display = 'none';
Expand Down

0 comments on commit b910dc5

Please sign in to comment.