Coder Social home page Coder Social logo

Comments (4)

mafar avatar mafar commented on June 19, 2024 1

ok the betetr fix would be just to wrap else if with `if(!this.beyondMaxLevels){``
at this postion. Now fixes my problem without adding any option

            // mjs - if the item is below a sibling and is moved to the right, make it a child of that sibling
            else if (o.allowRightMovement  
                     &&  previousItem != null
                     && ! previousItem.hasClass(o.disableNestingClass)
                     &&
                        (previousItem.children(o.listType).length && previousItem.children(o.listType).is(':visible')
                         || ! previousItem.children(o.listType).length)
                     && ! (o.protectRoot && this.currentItem[0].parentNode == this.element[0])
                     &&
                        (o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize)
                         || ! o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))
            ) {

                this._isAllowed(previousItem, level, level+childLevels+1);

                if(!this.beyondMaxLevels){
                    if (!previousItem.children(o.listType).length) {
                        previousItem[0].appendChild(newList);
                        o.isTree && previousItem.removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
                    }

                    // mjs - if this item is being moved from the top, add it to the top of the list.
                    if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
                        previousItem.children(o.listType).prepend(this.placeholder);
                    }
                    // mjs - otherwise, add it to the bottom of the list.
                    else {
                        previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
                    }

                    this._trigger("change", event, this._uiHash());
                }

            }

from nestedsortable.

mafar avatar mafar commented on June 19, 2024

When there is max depth =2 , why would it even allow some item to be pulled right ? and make it child. Doesnot make sense.

from nestedsortable.

mafar avatar mafar commented on June 19, 2024

#31
I solved it by adding 2 options.
allowRightMovement : true/false //whether the item is allowed to move the left by mouse
allowLeftMovement : true/false //whether the item is allowed to move the right by mouse

from nestedsortable.

LrntL avatar LrntL commented on June 19, 2024

Thanks

from nestedsortable.

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.