Skip to content

Commit

Permalink
fix: replace default index with draggable indexes. Fixes: #164
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilchlebek committed Jan 24, 2020
1 parent 368ba2b commit 615d9fe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions projects/ngx-sortablejs/src/lib/sortablejs.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ export class SortablejsDirective implements OnInit, OnChanges, OnDestroy {
onUpdate: (event: SortableEvent) => {
const bindings = this.getBindings();

bindings.injectIntoEvery(event.newIndex, bindings.extractFromEvery(event.oldIndex));
bindings.injectIntoEvery(event.newDraggableIndex, bindings.extractFromEvery(event.oldDraggableIndex));
this.proxyEvent('onUpdate', event);
},
};
}

}

interface SortableEvent { oldIndex: number; newIndex: number; item: HTMLElement; clone: HTMLElement; }
interface SortableEvent {
oldIndex: number;
newIndex: number;
oldDraggableIndex: number;
newDraggableIndex: number;
item: HTMLElement;
clone: HTMLElement;
}

0 comments on commit 615d9fe

Please sign in to comment.