Giter Club home page Giter Club logo

Comments (12)

Prakkus avatar Prakkus commented on June 27, 2024 1

Ah, of course. That approach is probably better anyway.

I would maybe just add a bit in the documentation that says something like "Normally you would hook into Sortable events using the options, but instead you should use vue's watch API like so simple example here".

Maybe not worth doing if I'm the only person who couldn't figure it out though :)

from vue.draggable.

lukepolo avatar lukepolo commented on June 27, 2024 1

Ah your awesome thank you

from vue.draggable.

David-Desmaisons avatar David-Desmaisons commented on June 27, 2024

Hi @logust , I would suggest that you watch directly the change events on the underlying Vm collection using vuejs watch API. This should cover the scenario you want to address. Please tell me if that would work for you and if not, please explain what you want to achieve. Thanks.

from vue.draggable.

David-Desmaisons avatar David-Desmaisons commented on June 27, 2024

Hi @logust , you are rigth: I will update the documentation and then close the issue.

from vue.draggable.

David-Desmaisons avatar David-Desmaisons commented on June 27, 2024

Documentation updated

from vue.draggable.

lukepolo avatar lukepolo commented on June 27, 2024

@David-Desmaisons I have an issue where I have 1 list that is in a bucket with a particular order , and the other that doesn't matter the order.

So I need the ability to sort list1 when list1 changes. Which means i cannot use the watch method because it will have a loop.

Ideas how to get around this?

from vue.draggable.

David-Desmaisons avatar David-Desmaisons commented on June 27, 2024

@lukepolo please open another issue with a jsfiddle descibing what you want to achieve and what is the problem. Thanks.

from vue.draggable.

lukepolo avatar lukepolo commented on June 27, 2024

Here is my jsfiddle

https://jsfiddle.net/jyf2fuwj/4/

Im trying to make sure the list 1 is in the proper order

from vue.draggable.

David-Desmaisons avatar David-Desmaisons commented on June 27, 2024

You can use sort:false as option on the list that should not be reordered: https://jsfiddle.net/dede89/4amr9hdp/.
Is that the behaviour you want:

from vue.draggable.

lukepolo avatar lukepolo commented on June 27, 2024

No sorry ill try to explain it better.

Each entry in my list has a property called order , this dictates the order, the items must be displayed.

When someone drags from a item from list 2 to list 1 , list 1 then reorders based on their order property

from vue.draggable.

lukepolo avatar lukepolo commented on June 27, 2024

Also list 2 does not care of the order of its items.

from vue.draggable.

David-Desmaisons avatar David-Desmaisons commented on June 27, 2024
  1. observe event linked to drag and drop not underlying collection
  2. use next tick to avoid the loop

Here:

https://jsfiddle.net/dede89/4amr9hdp/

from vue.draggable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.