Comments (10)
It is true: after i added id
attribute to a <li>
elements, problem had been solved.
from nestedsortable.
Simply removing the if statement in its entirety seems to help (of course leaving the trigger), but are there any consequences to this?
from nestedsortable.
I confirm the issue.
I honestly have no clue what this if statement is supposed to do, or mean, so I'm a bit afraid to touch it.
Btw, I debugged it and IMHO you can safely remove it. I guess the following meaning:
this._pid_current === this._uiHash().item.parent().parent().attr("id")
_pid_current
should contain the id
of the source list, while the right side reads id
of the target list.
this._sort_current === this._uiHash().item.index())
_sort_current
should contain index of the item in the source list and the right side reads the index in the target list.
IMHO the issue occurs when there are multiple lists without id
s and the movement among them on the same level. Then the condition results in if ( ! (undefined === undefined && index === index ) )
which is always false
that is why the event is not fired.
If my explanation is correct, there is only one consequence of the if
removal: The event will we fired even when no actual movement is performed, i.e., when the position remains same.
from nestedsortable.
I confirm - if you use other than 'id' attribute ... something like 'data-id' or something - th eproblem occurs. The attribute shouldn't be hardcoded, since other stuff like toArray method make it flexible.
from nestedsortable.
Put in a pull request to fix it?
from nestedsortable.
Any suggestion how to workaround this consequence?
The event will we fired even when no actual movement is performed, i.e., when the position remains same.
I think of keeping this with && id !== undefined
. That would reduce the impact of this consequence to trees without id
s. But still it is not optimal. Thoughts?
I'd create the PR then.
from nestedsortable.
This won't help, as it will effectively turn of the identification of the leaves. The real solution would be to add an option to define the ID holding html attribute (same as the one used by toArray), default it to 'id' and use it on both places - in relocate and _clear methods.
from nestedsortable.
Would you take care of it, @lllopo? Sounds you've thought it through.
from nestedsortable.
Good day , I encountered same problem since there is no official fix for that I created workaround outside the plugin, for my case I have used update function and there I retrieve id of the item that is moved after that jQuery grab that item and find it's parent..
Here is my example if someone is curious..
$('.sortable').nestedSortable({ handle: 'div', items: 'li', maxLevels:0, toleranceElement: '> div', update: function(event,ui) { treeChange(ui.item.attr("id"),$("#"+ui.item.attr("id")).parent().parent().attr("id")); } });
from nestedsortable.
I was experiencing the same issue, the solution suggested by @FlameArt did the trick. I simply added <li id="*someid*">···</li>
from nestedsortable.
Related Issues (20)
- 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
- Not working with jquery-ui v. 1.13.2
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.