Giter Site home page Giter Site logo

Comments (5)

zjffun avatar zjffun commented on May 27, 2024 1

I also think it's good to prevent manipulate DOM, but no one has merged PR and released a new version recently for this project. There is another idea I found in react-sortablejs that revert nodes to pre-drag position then change React state.

  1. record where the node is when start dragging
  2. put it back after dragging
  3. remove redundant nodes
  4. update state

from draggable.

hnrq avatar hnrq commented on May 27, 2024 1

Okay, I gave up on Dragula because it is too slow on mobile. I'll figure out how to make that event cancellable

from draggable.

zjffun avatar zjffun commented on May 27, 2024

I used to update the state (e.g.: items list array) when drag:stop or drag:stoppedand then draggable elements re-rendered because the state changed. The above approach doesn't need to prevent or cancel any event, but it is not performant because all draggable elements are re-rendered after sorted.

from draggable.

hnrq avatar hnrq commented on May 27, 2024

I used to update the state (e.g.: items list array) when drag:stop or drag:stoppedand then draggable elements re-rendered because the state changed. The above approach doesn't need to prevent or cancel any event, but it is not performant because all draggable elements are re-rendered after sorted.

I'm trying to do something similar, but I'm currently getting two instances of the same item into the list (Probably happens because Solid does not re-render the container, but only appends a new instance). It would be really good if preventing the new node from being appended were possible.

from draggable.

hnrq avatar hnrq commented on May 27, 2024

Good idea! I might try and take a look into the lib, however, looks like there are lots of PRs waiting to be merged and no updates on master for a long time :/. That's a bummer, I might as well give dragula a try, seems like it has a similar API

from 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.