Comments (4)
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.
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.
#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.
Thanks
from nestedsortable.
Related Issues (20)
- Uncaught RangeError: Maximum call stack size exceeded HOT 1
- Load from AJAX data
- Allow Drag-Drop from one nestedSortable tree to another HOT 2
- Is there any way to make it work on mobile devices? HOT 1
- Depth count - difference between current code and demo
- Store nestedSortable into the Database HOT 2
- Does not working if inserting into blank branch
- Prefix for item is forced since 2.0
- Depth and Index
- iPad moving
- Has anyone gotten this to work on mobile devices (touch support)? HOT 1
- Maintain nesting level. Prevent item being dropped in parent but allow another container of same level
- Where is the Placeholder move along X-axis defined?
- How 3rd level sub menu in menu.liquid
- Create a dynamic nested sortable accordion
- Allow parent change on items that are not parents?
- Sorting Breaks with jQuery UI 1.13+ HOT 4
- Scrolling issue using laptop touch page
- Release of new version?
- "jquery-ui/ui/sortable" is a reference to jquery-ui version 11 only
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestedsortable.