Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Faster way to get new index onEnd/onUpdate #148

Closed
dandv opened this issue Dec 4, 2014 · 1 comment
Closed

Faster way to get new index onEnd/onUpdate #148

dandv opened this issue Dec 4, 2014 · 1 comment

Comments

@dandv
Copy link
Contributor

dandv commented Dec 4, 2014

The solution on SO is clever, but its complexity is O(n*3). If Sortable maintains this state internally already, would it be possible to pass an extra parameter to onAdd onEnd, onUpdate and OnSort, that specifies the position of the displaced element, i.e. where the dragged element is being dropped?

This parameter would be passed after evt:

function onUpdate = function (event, newPos) { ... }
@RubaXa
Copy link
Collaborator

RubaXa commented Dec 4, 2014

If you know how to do it differently, offer your solution.
But, you need to pass through the event object:

  • evt.item
  • evt.oldIndex
  • evt.newIndex

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

No branches or pull requests

2 participants