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

How to not move items / How to only call callback/emit change event? #1874

Closed
igorlvicente opened this issue Aug 4, 2020 · 5 comments · May be fixed by procore/Sortable#1
Closed

How to not move items / How to only call callback/emit change event? #1874

igorlvicente opened this issue Aug 4, 2020 · 5 comments · May be fixed by procore/Sortable#1

Comments

@igorlvicente
Copy link

My problem is that I use Sortable with Vue.
That means that the array (therefore the order of the items) are defined by a state outside of Sortable and DOM.
I have this problem that I was not able to solve:

  1. Move item from position initial to final
  2. onEnd calls callback or parent's callback
  3. Validate some rules. Item should not be moved.
  4. Show error on screen for user
  5. List on state keeps the original order (item is in position initial)
  6. DOM has the wrong order final

I think the way would it be to not change the order on DOM, just trigger a change to be handled for whatever has the power.
I don't know if I make myself clear enough, but any questions, let me know.

@waynevanson
Copy link
Contributor

@igorlvicente Have you checked out the vue bindings?

@igorlvicente
Copy link
Author

@igorlvicente Have you checked out the vue bindings?

No, I have not. Where can I read about it?

@waynevanson
Copy link
Contributor

@igorlvicente https://github.com/SortableJS/Vue.Draggable

Because Sortable manipulates the DOM and so does Vue, the bindings basically reverses what Sortable does and allows Vue to take control.

@igorlvicente
Copy link
Author

That doesn't help my specific case because I use the Element UI library and I don't have access to the sortable items' wrapper.

@yaolunmao
Copy link

I also encountered this problem. Have you solved it

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

Successfully merging a pull request may close this issue.

3 participants