Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Events should also return the element #105

Open
MickL opened this issue Feb 27, 2024 · 2 comments
Open

Events should also return the element #105

MickL opened this issue Feb 27, 2024 · 2 comments

Comments

@MickL
Copy link

MickL commented Feb 27, 2024

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.

@adamleemiller
Copy link

I second this.

@MickL
Copy link
Author

MickL commented Mar 5, 2024

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants