Skip to main content

Search and Top Navigation

#4703 closed bug (worksforme)

Opened July 22, 2009 11:18AM UTC

Closed March 12, 2013 11:12AM UTC

Sortable: nested sortables sometimes allow recursive drops

Reported by: kae Owned by: kae
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.7.2
Keywords: haspatch Cc:
Blocked by: Blocking:
Description

http://verens.com/demos/php_and_jquery/8-2-sorting-trees/sorting-trees.php

it is sometimes possible to drag an element into one of its own contained lists.

to replicate this in my link above, just drag the Home item slowly downwards. periodically, you will see the drop marker (the red line) flash inside the Home item itself. if you drop at that point, then the element tries to move into itself and vanishes from view, leaving a browser error.

Attachments (2)
  • ui.sortable.js.diff (4.7 KB) - added by kae July 23, 2009 10:08PM UTC.

    much better patch - use this one instead

  • ui.sortable.patch (0.4 KB) - added by kae July 23, 2009 07:42PM UTC.

    bug-fix

Change History (17)

Changed July 23, 2009 07:37PM UTC by kae comment:1

can be solved by adding this to position 644 in ui.sortable.js

if($.ui.contains(this.currentItem[0],this.containers[i].element[0]))continue;

Changed July 24, 2009 01:38PM UTC by kae comment:2

example of the fixed script in action

http://verens.com/demos/nested-sortables/nested-sortables.html

compare with demo in main post

Changed July 28, 2009 05:51AM UTC by paul comment:3

resolution: → fixed
status: newclosed

Fixed in r2999, thanks!

Changed July 29, 2009 07:48AM UTC by mvug comment:4

doesn't seem to work quite well in IE8...

Changed May 19, 2010 05:05AM UTC by bhellman1 comment:5

resolution: fixed
status: closedreopened

Hello, I'm interested in trying this patch to allow for nested sortables but the links above are dead. Where can the patch be found / demo?

thxs

Changed May 19, 2010 08:09AM UTC by kae comment:6

try this instead: http://demo.verens.com/nested-sortables/nested-sortables.html

action is a bit jerky. I remember solving that once, but reverted for some reason that escapes me.

probably easier to use a different plugin for this (jstree for example) until someone with better insight than me figures it out.

Changed May 19, 2010 02:51PM UTC by bhellman1 comment:7

@Kae, very nice it seems like you got it closer. Maybe CSS is the reason for the jumpyness? I'd love to use JSTREE but sadly it doesn't support moving handlers, which prevents me from putting userinteractable items in the list item like checkboxes comments etc...

Any interest in moving your solution to the next level? Tons of people are looking for this type of solution that allows nested sortables, that can searalize and is built on top of JQUERY UI.

Changed May 19, 2010 03:15PM UTC by kae comment:8

I don't have the time at the moment (busy with a 9-5 job, and a book that I'm nearly 2 weeks behind on), but may come back to it in a few weeks.

hmmm... having said that, here's a more stable one:

http://demo.verens.com/nested-sortables.2/nested-sortables.html

just added back in an old line at L1037:

&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container

I can't spare more time on this at the moment.

Changed March 22, 2011 01:50PM UTC by eis-os comment:9

_comment0: Would it be possible to enable the following (mentioned) code again?[[BR]] \ {{{ \ && itemElement.parentNode == this.placeholder[0].parentNode" [[BR]] \ }}} \ \ This prevents flickering and jumping problems moving nested sortable items into a children that got sortable too. Or at least an option to enable this?1300801876387019

Would it be possible to enable the following (mentioned) code again?

&& itemElement.parentNode == this.placeholder[0].parentNode"

This prevents flickering and jumping problems moving nested sortable items into a children that got sortable too. Or at least an option to enable this?

Changed October 11, 2012 09:07PM UTC by scottgonzalez comment:10

milestone: TBD2.0.0

Changed October 27, 2012 08:19PM UTC by mikesherov comment:11

status: reopenedopen

Changed October 29, 2012 05:34AM UTC by mikesherov comment:12

keywords: → haspatch
summary: nested sortables sometimes allow recursive dropsSortable: nested sortables sometimes allow recursive drops

Please note that the fixes presented here don't work in IE8 and they'd need to for a patch to be accepted.

Changed October 29, 2012 05:34AM UTC by mikesherov comment:13

#4729 is a duplicate of this ticket.

Changed March 04, 2013 04:45AM UTC by tj.vantoll comment:14

owner: → kae
status: openpending

I ported the only functioning test case listed here over to jsFiddle and I'm not seeing any issues against master - http://jsfiddle.net/tj_vantoll/FRy2k/. I tested in Firefox, Chrome, and IE8 since it was explicitly listed.

Can anybody else recreate this?

Changed March 11, 2013 02:34PM UTC by mikesherov comment:15

I'm fairly certain this is now fixed, years ago. Leave it as pending in case OP miracously has a new test case.

Changed March 12, 2013 07:35AM UTC by kae comment:16

status: pendingnew

the jsFiddle example appears to be working fine, so consider the problem fixed. I don't have rights to modify the ticket to mark it as done.

Changed March 12, 2013 11:12AM UTC by mikesherov comment:17

resolution: → worksforme
status: newclosed