Giter Site home page Giter Site logo

Comments (7)

jasonslyvia avatar jasonslyvia commented on August 17, 2024 1

I kind of got it working and here's a brief demo, is it what you expected?

may-07-2016 20-17-59

from react-anything-sortable.

jasonslyvia avatar jasonslyvia commented on August 17, 2024

It's currently unsupported but I think it's achievable.

from react-anything-sortable.

AaronHarris avatar AaronHarris commented on August 17, 2024

Hmm, I can think of a few different instances where you'd want to specify the "allowed" positions that an element should be able to take (eg. only every even position, or every 5th position, or beginning or end, only next to some other type of element, etc). Which methods would one have to modify to support something like this?

I'm assuming the right methods would be swapArrayItemPosition (to control how / which items were swapped) and either calculateNewIndex or getIndexByOffset? I'm think the easiest way to support (just my use case - every other item) would be to mod 2 any newindex that would be assigned to the placeholder (I already have it so that when the user drops the item, it re-renders with the proper elements in the right spot).

from react-anything-sortable.

jasonslyvia avatar jasonslyvia commented on August 17, 2024

If we were to add this new feature, I'd like it to be adoptable by anyone other than only your case.

The solution I'm thinking of is providing an option like sortTarget, and only children's className match sortTarget will be sortable, anything else remains untouched.

I'll let you know if it works out, also a PR is warmly welcomed!

from react-anything-sortable.

AaronHarris avatar AaronHarris commented on August 17, 2024

Yes that's exactly what I was looking for! Much appreciated!

from react-anything-sortable.

jasonslyvia avatar jasonslyvia commented on August 17, 2024

Cool, I'll add according tests and release a new version.

from react-anything-sortable.

jasonslyvia avatar jasonslyvia commented on August 17, 2024

released 1.4.5

from react-anything-sortable.

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.