Giter Site home page Giter Site logo

Comments (5)

rniemeyer avatar rniemeyer commented on August 17, 2024

Just want to make sure that I understand your situation to consider the right change. Can you describe specifically what you want to accomplish?

The 'allowDrop' option lets you control if a section is a target for drops and if it is observable or a function, then it will update dynamically.

The 'connectClass' could be set to something unique, if you don't want to participate with the other sections.

from knockout-sortable.

Mark-Robinson avatar Mark-Robinson commented on August 17, 2024

I have a deeply nested hierachy:

  • A
    • B
      • C
        • D
        • etc...
. and I only want the user to be able to drag and drop items on the same branch in the hierachy.

I would have to either put a unique connectClass on each level to ensure that the user can't drag and drop between levels in the hierachy (http://jsfiddle.net/unklefolk/LbeRE/1/) (I guess I would have to dynamically generate this class name). It does not seem to be enough just to supply a single unique connectClass that isn't actually applied to any elements (http://jsfiddle.net/unklefolk/sypLG/ - you can still drag and drop between the groups).

Or I would have to run a beforeMove test which I have tried (eg. arg.allowDrop = arg.targetParent() === arg.sourceParent()) but this didn't seem very reliable - maybe due to the flickery nature of jquery sorting when on the boundary between two elements.

If I had a simple way to inicate that connectWith should be false this would remove these issues and avoid extra processing.

from knockout-sortable.

rniemeyer avatar rniemeyer commented on August 17, 2024

Thanks for the clarification. Makes sense. Easy enough to provide this ability. You can now set it to null/false globally (ko.bindingHandlers.connectClass = false) or in the binding. e0d1bf3. Please reopen, if this does not meet your needs.

from knockout-sortable.

rniemeyer avatar rniemeyer commented on August 17, 2024

I just realized that you could actually just set allowDrop = false and nobody would be able to drop onto that list (but you can still sort within it).

So, an option would have been just to set ko.bindingHandlers.sortable.allowDrop = false like: http://jsfiddle.net/rniemeyer/sypLG/1/

There is still a subtle difference in that you would be able to drop from this list onto another list that accepted drops, so overall I think that having the option to set connectClass to null/false is good to have.

from knockout-sortable.

Mark-Robinson avatar Mark-Robinson commented on August 17, 2024

Thanks, Ryan. I've got your fix and it work great.

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