sortablejs-vue3
sortablejs-vue3 copied to clipboard
Events should also return the element
Hello,
within the events I need to know the id of my element, but I cant access the element:
<Sortable
:list="elements"
item-key="id"
@end="(event: Sortable.SortableEvent) => changeOrder(element.id, event.oldIndex, event.newIndex)"
>
...
This is because I need to know which item exactly has changed because possibly two items can have the same order.
I second this.
Right now the workaround is to keep a copy of the sorted array and sort it when sortable sorts its array. Then with newIndex I can find the element. This is how its done in the docs.
It wouldnt be required to do that when the event would simply return the element aswell.